Description
Get list of packages.
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. |
name | string | Optional parameter to search by name. |
usageStartDate | string | Start date for package's usage info. If not specified, will be current billing cycle. |
usageEndDate | string | End date for package's usage info. If not specified, will be today. |
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 an array with package data.
Json sample code
<?php $curl = curl_init('https://your_address/ccm/admin/api/version/2/&type=json'); $postData = array( 'function' => 'getPackages', 'apiKey' => 'apiKey', ); 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] => 6 [contractId] => 1 [type] => email [softLimit] => 25000 [hardLimit] => 25000 [period] => 1 month [startDate] => 2011-11-23 [description] => Bono de emails [warningDate] => 0000-00-00 [hardWarningDate] => 0000-00-00 [warningPercentage] => 90 [active] => 1 [subscribersLimit] => 5000 [usage] => stdClass Object ( [startDate] => 2012-01-23 00:00:00 [endDate] => 1970-01-01 01:33:32 [totalItems] => 25000 [sentItems] => 42 ) ) )