Description
Get a list of campaigns.
Params
Name | Type | Description |
---|---|---|
apiKey | string | API key previously generated. |
offset | integer | Optional parameter to specify offset. |
count | integer | Optional parameter to specify the number of records. |
id | integer | Optional parameter to search by id. |
subject | string | Optional parameter to search by subject. |
deleted | boolean | Optional parameter to search deleted campaigns |
sortField | string | Optional parameter to specify a search field. |
sortOrder | string | Optional parameter to specify a sort order. Accepted values are ASC and DESC (default). |
Returned data
Type: array
Description: Return array with campaigns data.
Json sample code
<?php $curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json'); $postData = array( 'function' => 'getCampaigns', 'apiKey' => 'apiKey', 'offset' => 0, 'count' => 2, ); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($postData)); 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
Array ( [0] => stdClass Object ( [id] => 18 [subject] => Envio utilizando API sendMail [mailbox_from_id] => 1 [mailbox_reply_id] => 1 [mailbox_report_id] => 1 [email_report] => 0 [smtp_id] => 0 [model] => 0 [groups] => 15 [text] => [html_header] => [html_style] => [html] => [attachs] => a:0:{} [urls] => [date] => 2012-02-16 13:06:20 [created] => 2012-02-16 13:06:20 [last_sent] => 2012-02-16 13:08:17 [deleted] => 0 [permanently_deleted] => 0 [start_sent] => [send_date] => [subscribers_total] => 0 [subscribers_invalid] => 0 [exclude_invalids] => 1 [is_relay] => 0 [encoding] => [package_id] => 6 [id_campaign_folder] => -3 [subject_encoding] => [url_token] => 0 ) [1] => stdClass Object ( [id] => 17 [subject] => Envio utilizando API sendMail [mailbox_from_id] => 1 [mailbox_reply_id] => 1 [mailbox_report_id] => 1 [email_report] => 0 [smtp_id] => 0 [model] => 0 [groups] => 14 [text] => [html_header] => [html_style] => [html] => [attachs] => a:0:{} [urls] => [date] => 2012-02-16 13:06:03 [created] => 2012-02-16 13:06:03 [last_sent] => 2012-02-16 13:08:17 [deleted] => 0 [permanently_deleted] => 0 [start_sent] => [send_date] => [subscribers_total] => 0 [subscribers_invalid] => 0 [exclude_invalids] => 1 [is_relay] => 0 [encoding] => [package_id] => 6 [id_campaign_folder] => -3 [subject_encoding] => [url_token] => 0 ) )