updateCampaign

Description

Update campaign using its ids.



Params

NameTypeDescription
apiKeystringAPI key previously generated.
idintegerId of the campaign that you want to update.
subjectstringSubject.
mailboxFromIdintegerId of the mailbox that will be used on the From header. You can get all mailboxes using function.
mailboxReplyIdintegerId of the mailbox that will be used on the Reply-To header. You can get all mailboxes using function.
mailboxReportIdintegerMailbox report id. You can get all mailboxes using function.
emailReportbooleanTrue if an email report should be sent after list has finished.
groupsarrayArray containing groups id for this campaign. Example for groups 1 and 7: array( 1, 7 ).
textstringOptional parameter to specify a plain text version. If not set, a text version will be automatically generated from html.
htmlstringHtml content.
packageIdintegerPackage’s id that this campaign should use.
attachmentsarrayOptional 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.
campaignFolderIdintegerOptional parameter to store campaign’s folder id.
urlTokenbooleanAdd tokens to all tracked urls. If not set, it will be false.
analyticsUtmCampaignstringOptional 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)