Reporting summary
Retrieves a status summary on individual items within a date range. Use a start date and end date in the following format: YYYY-MM-DD. The end date will include everything on that day.https://api-eu1.stannp.com/v1/reporting/summary/:startdate/:enddate
Status codes
received | We have received the request. |
producing | We are printing or finishing the mailpiece. |
handed_over | We have handed the mailpiece over to the delivery service (Royal Mail, etc). |
local_delivery | The item is at the final delivery office and will be delivered within 24 hours. |
delivered | We estimate the item has been successfully delivered. |
returned | The item was returned. Normally due to incorrect recipient details. |
cancelled | The item has been cancelled before it was produced and posted. |
Request
$ curl https://api-eu1.stannp.com/v1/reporting/summary/:startdate/:enddate \ -u {API_KEY}:
define("API_KEY", "YOUR API KEY"); $opts = array( 'http' => array( 'method' => 'GET', 'header' => 'Content-type: application/x-www-form-urlencoded' ) ); $context = stream_context_create($opts); $result = file_get_contents("https://api-eu1.stannp.com/v1/reporting/summary/:startdate/:enddate?api_key=" . API_KEY, false, $context); $response = json_decode($result, true); print_r($response);
import requests response = requests.get('https://api-eu1.stannp.com/v1/reporting/summary/:startdate/:enddate?api_key={API_KEY}') print(response.text)
var client = new RestClient("https://api-eu1.stannp.com/v1/reporting/summary/:startdate/:enddate?api_key={API_KEY}"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);Response
{ "success": true, "data": { "total": 2000, "received": 0, "printing": 0, "handed_over": 0, "local_delivery": 400, "delivered": 1599, "returned": 1, "cancelled": 0 } }
List mailpieces
Retrieves a list of mailpiece objects sent within the specified date range.Status and tag filters are optional. You can use the
offset
and limit
parameters in a query string for
pagination as seen in the example request. Eg. ?offset=0&limit=100
https://api-eu1.stannp.com/v1/reporting/list/:startdate/:enddate/[:status]/[:tag]
Request
$ curl https://api-eu1.stannp.com/v1/reporting/list/2018-02-11/2018-02-11/all/tag123 \ -u {API_KEY}:
define("API_KEY", "YOUR API KEY"); $opts = array( 'http' => array( 'method' => 'GET', 'header' => 'Content-type: application/x-www-form-urlencoded' ) ); $context = stream_context_create($opts); $result = file_get_contents("https://api-eu1.stannp.com/v1/reporting/list/2018-02-11/2018-02-11/all/tag123?api_key=" . API_KEY, false, $context); $response = json_decode($result, true); print_r($response);
import requests response = requests.get('https://api-eu1.stannp.com/v1/reporting/list/2018-02-11/2018-02-11/all/tag123?api_key={API_KEY}') print(response.text)
var client = new RestClient("https://api-eu1.stannp.com/v1/reporting/list/2018-02-11/2018-02-11/all/tag123?api_key={API_KEY}"); var request = new RestRequest(Method.GET); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content);Return
{ "success": true, "data": { "singles": [ { "id": "6829954", "timestamp": "2018-02-11 07:08:55", "status": "delivered", "type": "postcard", "format": "A6", "pdf_file": "https:\/\/dash.stannp.com\/api\/v1\/storage\/get\/bourbon\/1518386934\/pdf-production\/000000000000000-0000000.pdf", "dispatched": "2018-02-11 15:12:52", "country": "GB", "cost": "0.42", "insert_pdf": null, "insert_size": null, "addons": "", "tags": "tag123,tag456", "postcode": "EX31 1JZ", "address": "Unit 12 Taw Trade Park" }, { "id": "6829955", "timestamp": "2018-02-11 07:08:56", "status": "delivered", "type": "postcard", "format": "A6", "pdf_file": "https:\/\/dash.stannp.com\/api\/v1\/storage\/get\/bourbon\/1518386934\/pdf-production\/000000000000000-0000000.pdf", "dispatched": "2018-02-11 15:12:52", "country": "GB", "cost": "0.42", "insert_pdf": null, "insert_size": null, "addons": "", "tags": "tag123", "postcode": "EX31 1JZ", "address": "Unit 12 Taw Trade Park" } ] } }