REST SMS Gateway API – deliveryReports resource

  • Why not share:
  • Social sharing button for Facebook
  • Social sharing button for Linkedin
  • Social sharing button for Twitter
  • Social sharing button for Googleplus
  • Social sharing button for Pinterest

This blog post has been superseded with our website documentation


This document is referred to by the REST SMS Gateway API – Specification Document.

Resource URI:

Actions on the list of available delivery reports.

  • GET method - Gets a list of available delivery report names

The REST API resource deliveryReports (note the trailing ‘s’) performs actions on the list of available delivery report names, including delivery reports for campaigns.

A delivery report shows the current known status of all messages sent on a given day or for a particular campaign. To access the contents of a particular delivery report – which will contain the status of individual messages – you would use the deliveryReport resource instead - i.e. no trailing ‘s’.


GET method

Get the list of available delivery reports.

Example usage

Example GET response

<response processed_date="2010-03-19T15:20:49+00:00">
	<reports quantity="2" >
		<report name="test-190310" last_updated="2010-03-19T09:45:04+00:00" extension="csv"/>
		<report name="GatewayAPI_08-03-10" last_updated="2010-03-08T15:45:02+00:00" extension="csv"/>

Read the advanced specification of this response.

When we receive a delivery report from the operator this gets added to a delivery report with a standardised name. The naming format is as follows: “GatewayAPI_DD-MM-YY” where DD is the day in the month, MM is the month and YY is the year, each being in a 2-digit format. So for example:

GatewayAPI_04-01-09     is valid
GatewapAPI_12-12-09     is valid
GatewayAPI_1-1-9        is invalid

Specific error codes



Although it is expected that you will want to use the deliveryReport resource to get the contents of a delivery report, the response as shown above contains all the information necessary to download the delivery reports in csv format, if that is your preferred method. In this case each report can be accessed via the URL[dir]/[filename]


[dir] = the user directory as found in the response above, i.e. in the above example aBcDeFgHiJkLmNoPqRsTuVwZ
[filename] = the name of the csv file to download, e.g. GatewayAPI_08-03-10.csv

So the complete URL in this example would be:

Example PHP code

 * GET request on the deliveryReports resource
$url = '';
$username = 'myAPIusername'; // CHANGE THIS!!!
$password = 'myAPIpassword'; // CHANGE THIS!!!
$url = "$url?username=$username&password=$password";

// we're using the curl library to make the request
$curlHandle = curl_init();
curl_setopt($curlHandle, CURLOPT_URL, $url);
curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true);
$responseBody = curl_exec($curlHandle);
$responseInfo  = curl_getinfo($curlHandle);

// deal with the response
if ($responseInfo['http_code']==200)
	$xml_obj = simplexml_load_string($responseBody);
	$atts = $xml_obj->reports->attributes();
	$num_reports = (int) $atts->quantity;

	if ($num_reports > 0)
		echo "$num_reports reports\n";
		$reports = array();
		foreach ($xml_obj->reports->report as $xml_report)
			$atts = $xml_report->attributes();
			$name = (string) $atts->name;
			$updated = (string) $atts->last_updated;
			$reports[] = array('name'=>$name, 'modified'=>$updated);
		// do something with the report details
	} else {
		echo 'No reports available';
} else {
	// handle the error

No related posts.