updateCampaign

Description

Update campaign using its ids.



Params

Name Type Description
apiKey string API key previously generated.
id integer Id of the campaign that you want to update.
subject string Subject.
mailboxFromId integer Id of the mailbox that will be used on the From header. You can get all mailboxes using function.
mailboxReplyId integer Id of the mailbox that will be used on the Reply-To header. You can get all mailboxes using function.
mailboxReportId integer Mailbox report id. You can get all mailboxes using function.
emailReport boolean True if an email report should be sent after list has finished.
groups array Array containing groups id for this campaign. Example for groups 1 and 7: array( 1, 7 ).
text string Optional parameter to specify a plain text version. If not set, a text version will be automatically generated from html.
html string Html content.
packageId integer Package’s id that this campaign should use.
attachments array Optional parameter in case you want to add attachments. Its elements should follow this structure:

array( ‘name’ => ‘Filename.jog’, ‘data’ => ‘DataEncodedInBase64’ ) The data parameter is the content of the file encoded with base64.
campaignFolderId integer Optional parameter to store campaign’s folder id.
urlToken boolean Add tokens to all tracked urls. If not set, it will be false.
analyticsUtmCampaign string Optional parameter to set the utm_campaign for Google Analytics.

 

Returned data

Type: boolean

Description: Return true if campaign was updated.

 

Json sample code

<?php

$curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json');

$postData = array(
    'function' => 'updateCampaign',
    'apiKey' => 'apiKey',
    'id' => 5,
    'subject' => 'My Promotion',
    'mailboxFromId' => 1,
    'mailboxReplyId' => 1,
    'mailboxReportId' => 1,
    'emailReport' => true,
    'groups' => array(
        1,
        5
    ),
    'text' => null,
    'html' => '<html><body>Buy!</body></html>',
    'packageId' => 6,
    'campaignFolderId' => 1,
);

$post = http_build_query($postData);

curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);

$json = curl_exec($curl);
if ($json === false) {
    die('Request failed with error: '. curl_error($curl));
}

$result = json_decode($json);
if ($result->status == 0) {
    die('Bad status returned. Error: '. $result->error);
}

var_dump($result->data);

 

Result of API call

bool(true)
Menu Title