REST SMS Gateway API – deliveryReports resource
Posted on June 16th, 2010 by Jay.
Categories: All SMS Gateway Documentation, Business SMS, Documentation, Technical
This blog post has been superseded with our website documentation
deliveryReports
This document is referred to by the REST SMS Gateway API – Specification Document.
Resource URI:
http://www.textmarketer.biz/services/rest/deliveryReports
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
Get the list of available delivery reports.
Example usage
http://www.textmarketer.biz/services/rest/deliveryReports
Example GET response
<response processed_date="2010-03-19T15:20:49+00:00"> <userdirectory>aBcDeFgHiJkLmNoPqRsTuVwZ</userdirectory> <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"/> </reports> </response>
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
N/A
Note
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
http://www.textmarketer.biz/DeliveryReports/[dir]/[filename]
where
[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:
http://www.textmarketer.biz/DeliveryReports/aBcDeFgHiJkLmNoPqRsTuVwZ/GatewayAPI_08-03-10.csv
Example PHP code
<?php
/**
* GET request on the deliveryReports resource
*/
$url = 'http://www.textmarketer.biz/services/rest/deliveryReports';
$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);
curl_close($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
var_dump($reports);
} else {
echo 'No reports available';
}
} else {
// handle the error
var_dump($responseBody);
}
?>
Popularity: 7%
Related posts:
- REST SMS API Code Examples
This blog post has been superseded with our website documentation In our REST API specification document we saw, in general terms, how to... - REST SMS Gateway API – credits resource
This blog post has been superseded with our website documentation credits This document is referred to by the REST SMS Gateway API –... - REST SMS Gateway API – Specification Document
This blog post has been superseded with our website documentation For an overview of what REST and our RESTful SMS API is all... - PHP 5 Delivery Report Helper Class for our SMS Gateway
Class Name: ProcessDeliveryReport This class enables you to access your delivery reports in a nice simplified way. You can search for... - Using the SMS Gateway API, Automating Delivery Report Collection
This blog post has been superseded with our website documentation Introduction If you are using the API / Gateway to send bulk SMS... - RESTful Web Services SMS Gateway API Overview
This blog post has been superseded with our website documentation In addition to our simple HTTP SMS Gateway API, explained here, we also... - SMS Gateway API – Specification
This blog post has been superseded with our website documentation It is recommended that you use the RESTful version of the API which has largely superseded this document... - Can I pick up a delivery report for my SMS campaign?
Yes How to collect delivery reports. Download the PDF instruction manual for the main functions of the system Go to... - The SMS Gateway
How to use an SMS Gateway Continue reading →... - Concatenated “Long Message” SMS feature now Live for the Bulk SMS system and the SMS Gateway
You can now send text messages longer than 160 characters, in fact up to 612 characters which arrive as 1...



