To get the contents of a delivery report for the campaign name 'mycampaign-020411':
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DeliveryReport[] reports = tmClient.getDeliveryReport("mycampaign-020411"); |
To get the delivery report details for 'mycampaign-020411' between 01:00 and 02:00 on 1st Jan 2011:
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
Calendar cal_start = Calendar.getInstance(); cal_start.set(2011, 1, 1, 1, 0, 0); Calendar cal_end = Calendar.getInstance(); cal_end.set(2011, 1, 1, 2, 0, 0); DeliveryReport[] reports = tmClient.getDeliveryReport("mycampaign-020411", cal_start.getTime(), cal_end.getTime); |
Or, between 01:00 on 1st Jan 2011 and now:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Calendar cal = Calendar.getInstance(); cal.set(2011, 1, 1); DeliveryReport[] reports = tmClient.getDeliveryReport("mycampaign-020411", cal.getTime(), new Date()); |
To get delivery report details for all campaigns and API sends between the same dates as the previous 2 examples:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Calendar cal_start = Calendar.getInstance(); cal_start.set(2011, 1, 1, 1, 0, 0); Calendar cal_end = Calendar.getInstance(); cal_end.set(2011, 1, 1, 2, 0, 0); DeliveryReport[] reports = tmClient.getDeliveryReport("all", cal_start.getTime(), cal_end.getTime); reports = tmClient.getDeliveryReport("all", cal.getTime(), new Date()); |
To get a delivery report with the name 'mycampaign-020411', restricted to those messages sent with custom tag 'test':
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DeliveryReport[] reports = tmClient.getDeliveryReport("mycampaign-020411", "test"); |
To get the status of messages from all delivery reports for messages sent with custom tag 'test':
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DeliveryReport[] reports = tmClient.getDeliveryReport("all", "test"); |
The same as the previous 2 examples, but between 2 dates:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
Calendar cal_start = Calendar.getInstance(); cal_start.set(2011, 1, 1, 1, 0, 0); Calendar cal_end = Calendar.getInstance(); cal_end.set(2011, 1, 1, 2, 0, 0); DeliveryReport[] reports = tmClient.getDeliveryReport("all", "test", cal_start.getTime(), cal_end.getTime); reports = tmClient.getDeliveryReport("all", "test", cal.getTime(), new Date()); |
A complete example, including output:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
DeliveryReport[] reports = tmClient.getDeliveryReport("all"); for(DeliveryReport report: reports) { System.out.println(report); for(Hashtable<String, String> row: report.getRows()) { System.out.println("\tMessage ID: " + row.get("message_id")); System.out.println("\tLast Updated: " + row.get("last_updated")); System.out.println("\tMobile Number: " + row.get("mobile_number")); System.out.println("\tStatus: " + row.get("status")); System.out.println("\tCustom Tag: " + row.get("custom")); } } |