Message-ID: <177293409.15883.1614958588273.JavaMail.confluence@wiki> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_15882_1029259822.1614958588272" ------=_Part_15882_1029259822.1614958588272 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Retrieve an individual delivery report (or combined reports), which show=
s the current known status of messages sent in a given time period, or for =
a particular campaign or campaigns.
Conversely, the function getDelive=
ryReports (page 18) gets a list of available delivery report names, includi=
ng delivery reports for campaigns.
See also What is a sent message?
E messages sent with the API can be given a 'tag'. The getDeliveryReport= function allows you to specify that tag in order to restrict your search.<= /p>
To get the contents of a delivery report for the campaign name 'mycampai= gn-020411':
DeliveryReport[] reports =3D tmClient.getDeliveryReport("mycampaig= n-020411");=20
To get the delivery report details for 'mycampaign-020411' between 01:00= and 02:00 on 1st Jan 2011:
DeliveryReport[] reports =3D tmClient.getDeliveryReport("mycampaig= n-020411", new DateTime(2011, 1, 1, 1, 0, 0), DateTime(2011, 1, 1, 2, 0, 0));=20
Or, between 01:00 on 1st Jan 2011 and now:
DeliveryReport[] reports =3D tmClient.getDeliveryReport("mycampaig= n-020411", new=20 DateTime(2011, 1, 1, 1, 0, 0), DateTime.Today);=20
To get delivery report details for all campaigns and API sends between t= he same dates as the previous 2 examples:
DeliveryReport[] reports =3D tmClient.getDeliveryReport("all"= , new DateTime(2011, 1, 1, 1, 0, 0), DateTime(2011, 1, 1, 2, 0, 0)); reports =3D tmClient.getDeliveryReport("all", new DateTime(2011, = 1, 1, 1, 0, 0), DateTime.Today);=20
To get a delivery report with the name 'mycampaign-020411', restricted t= o those messages sent with custom tag 'test':
DeliveryReport[] reports =3D tmClient.getDeliveryReport("mycampaig= n-020411", "test");=20
To get the status of messages from all delivery reports for messages sen= t with custom tag 'test':
DeliveryReport[] reports =3D tmClient.getDeliveryReport("all"= , "test");=20
The same as the previous 2 examples, but between 2 dates:
DeliveryReport[] reports =3D tmClient.getDeliveryReport("all"= , "test", new=20 DateTime(2011, 1, 1, 1, 0, 0), DateTime(2011, 1, 1, 2, 0, 0)); reports =3D tmClient.getDeliveryReport("all", "test", n= ew DateTime(2011, 1, 1, 1, 0, 0), DateTime.Today);=20
A complete example, including output:
DeliveryReport[] reports =3D tmClient.getDeliveryReport("all"= ); foreach (DeliveryReport report in reports) { =09Console.WriteLine(report); =09foreach (Hashtable row in report.Rows) { =09=09Console.WriteLine("\tMessage ID: {0}", row["message_i= d"]); =09=09Console.WriteLine("\tLast Updated: {0}", row["last_upd= ated"]); =09=09Console.WriteLine("\tMobile Number: {0}", row["mobile_= number"]); =09=09Console.WriteLine("\tStatus: {0}", row["status"])= ; =09=09Console.WriteLine("\tCustom {0}", row["custom"]); =09} }=20
Arguments:
String name:
name of the delivery report to retrieve or 'all' to retrieve all campaig= n/API report data.
String custom:
restrict search to those SMS sent with a custom 'tag' (see custom parame= ter of sendSms function). Up to and including 20, alpha-numeric c= haracters.
Date date_start:
restrict search to be from date_start (Europe/London time).
Date date_end:
restrict search to be up to date_end (Europe/London time).
Returns:
A DeliveryReport object array. Each Hashtable represents a delivery repo=
rt and has 4 keys:
'name', 'last_updated', 'extension' and 'rows':
Hashtable key | Value |
---|---|
name | String. The name of the delivery report conta=
ining the message statuses. |
last_updated | String. The last time a message delivery stat= us in this delivery report was updated, ISO 8601 format. This allows you to= determine whether there was a change since you last accessed the report.= p> |
extension | DEPRECATED =E2=80=93 this value no longer has= any meaning. |
rows | ArrayList. rows is an ArrayList of Hashtable = with keys 'message_id', 'mobile_number', 'status' and 'last_updated' (see b= elow). |
reportrow is an array with 4 keys:
Hashtable key | Value |
---|---|
message_id | String. The unique ID of the sent message (di= fferent for each number sent to). |
mobile_number | String. The mobile number that the message wa= s sent to, in international format, e.g. 447000000000. |
status | String. The status of the message delivery.= p> PENDING means the status of the sent message is currently unknown. =REJECTED means that the relevant operator rejected the message and did n= ot attempt to deliver it. FAILED probably means that the number doesn= 't exist (or not anymore), or the recipient didn't turn on their phone to r= eceive the message and it expired. DELIVERED means the message was re= ceived on the handset. NON-UK means you are a UK-only account and hav= e tried to send a non-UK number. |
last_updated | String. The last time this message delivery s= tatus was updated, ISO 8601 format. This allows you to determine whether th= ere has been a change since you last accessed the report. |
Specific error codes:
Code | Meaning |
---|---|
0 | The custom value must contain only alpha-nume= ric characters. |
1 | The custom value must be between 1 and 20 charac= ters in length. |
2 | The 'from' and 'to' timestamps must be in ISO= 8601 format. |
error code 404 is reported if no delivery reports are found using the sp= ecified search criteria. See General error codes.