Syntax
object getBatchStatistics( string api_key, int batch_id );
API Key Access Level required: Standard access
Parameters
api_key
(string)The key required to access the API. See Getting Started for more information.
batch_id
(int)The ID of the Batch.
Return Value
Returns an object containing statistics for the Batch. See the remarks section below for the list of values this method returns.
Examples
PHP
$batch_id = 1234567;
$api = new Api($url, 'YOURAPIKEY');
$statistics = $api->invokeMethod('getBatchStatistics', $batch_id);
$api = new Api($url, 'YOURAPIKEY');
$statistics = $api->invokeMethod('getBatchStatistics', $batch_id);
JSON Request
{
"id": 1,
"method": "getBatchStatistics",
"params": [
"YOURAPIKEY",
1234567
]
}
"id": 1,
"method": "getBatchStatistics",
"params": [
"YOURAPIKEY",
1234567
]
}
JSON Response
{
"id": 1,
"result": {
"is_scheduled": 0,
"send_time": 1362621313,
"first_sent_time": 1362621338,
"last_sent_time": 1362621338,
"email_count": 32,
"unsent_count": 32,
"failed_count": 0,
"gross_html": 3,
"gross_plain": 0,
"html_open_count": 3,
"text_open_count": 0,
"opened_count": 3,
"not_opened_count": 29,
"bounce_count": 0,
"update_profile_count": 0,
"unsubscribe_count": 0,
"to_friend_count": 0,
"unique_to_friend_count": 0,
"unique_contact_click": 0,
"unique_link_click": 0,
"gross_click": 0,
"deactivated_count": 0,
"complained_count": 0,
"send_status": "completed",
"device_statistics": {
"desktop": {
"total_count": 2,
"percentage": 66.67
},
"mobile": {
"total_count": 0,
"percentage": 0
},
"unknown": {
"total_count": 1,
"percentage": 33.33
}
},
"mail_clients": {
"webmail_other": {
"title": "Webmail (Other)",
"total": 2,
"percent": 100
}
}
},
"error": null
}
"id": 1,
"result": {
"is_scheduled": 0,
"send_time": 1362621313,
"first_sent_time": 1362621338,
"last_sent_time": 1362621338,
"email_count": 32,
"unsent_count": 32,
"failed_count": 0,
"gross_html": 3,
"gross_plain": 0,
"html_open_count": 3,
"text_open_count": 0,
"opened_count": 3,
"not_opened_count": 29,
"bounce_count": 0,
"update_profile_count": 0,
"unsubscribe_count": 0,
"to_friend_count": 0,
"unique_to_friend_count": 0,
"unique_contact_click": 0,
"unique_link_click": 0,
"gross_click": 0,
"deactivated_count": 0,
"complained_count": 0,
"send_status": "completed",
"device_statistics": {
"desktop": {
"total_count": 2,
"percentage": 66.67
},
"mobile": {
"total_count": 0,
"percentage": 0
},
"unknown": {
"total_count": 1,
"percentage": 33.33
}
},
"mail_clients": {
"webmail_other": {
"title": "Webmail (Other)",
"total": 2,
"percent": 100
}
}
},
"error": null
}
Remarks
The following table shows the values that are returned.
Field | Type | Description |
---|---|---|
send_status |
string | The send status of the batch |
is_scheduled |
bool | Whether this was a scheduled send |
send_time |
int | The time the batch was to be sent |
first_sent_time |
int | The time the batch was first sent |
last_sent_time |
int | The time the batch was last sent |
email_count |
int | The number of messages sent |
unsent_count |
int | The number of message that have not yet been sent |
failed_count |
int | The number of messages that failed to send |
gross_html |
int | Total HTML message opens |
gross_plain |
int | Total Plain Text message opens |
html_open_count |
int | Unique HTML message opens |
text_open_count |
int | Unique Plain Text message opens |
opened_count |
int | Total messages opened. |
not_opened_count |
int | Total Messages not opened. |
bounce_count |
int | Total number of bounces |
update_profile_count |
int | Total contacts that updated their profile |
unsubscribe_count |
int | Total contacts that unsubscribed |
to_friend_count |
int | Total number sent to friends |
unique_contact_click |
int | Number of contacts that clicked a link |
unique_link_click |
int | Total number of unique link clicks by contacts |
gross_clicks |
int | Total number of link clicks |
deactivated_count |
int | Total number of deactivations |
complained_count |
int | Total number of complaints |
device_statistics |
array | An array of different devices and some details about the emails opened on them if available |
mail_clients |
array | An array of the different email clients used to open batch messages if available |
Error Codes
This method may return the following error code in addition to the standard error codes:
Code | Error | Description |
---|---|---|
308 |
Unable to load Batch | The system could not load batch_id . |