Batch method

This API returns details of generated labels that have been merged into one batch.

Before calling this method, labels need to be generated using the Generate method with the appropriate batch_id.

Try it here

API Details

URL HTTP Request Types Request Formats
https://api.uat.nzpost.co.nz/labels/batch/<api_code>/<batch_id> GET JSON, JSONP, HTML, PDF

Request Parameters

Parameter Description Required Value Maximum Length Example
api_code Your license's unique api_code for the application
This is public and will be used in the print url
e.g. https://label.dev/batch/<api_code>/<batch_id>.pdf
Yes String 98e7fhu
batch_id The batch_id assigned to the generated labels Yes String 255 batch4

Types of Response

Response Type Status Code
Success 200
Invalid Request 400
Label(s) Not Found 404

Response Elements

Note that a response can be 200 and still result in error. It is regarded as a queued error.

Element Description Value Required Example
status_code The status code for the response type. One of 'OK' or 'ERROR' String Yes OK
print_url The url path to download the merged pdf
api_code is required in the print_url to differentiate labels that have the same batch_id but are from different licenses
String No https://api.nzpost.co.nz/batch/7eyisf/bcdfh47fdgsd534.pdf
error_code The error code String No 2008
error_reason An explanation of the error String No PDF file not found

Error Codes

Error Code Error Reason
2000 Not Ready, try again soon.
2001 No label matching supplied uuid
2002 PDF Not Ready, try again soon.
2003 JSONP requires a callback parameter
2004 Label has been deleted, pdfs retained for only 3 months
2006 Missing mandatory request parameters
2007 There are no labels matching the supplied batch_id
2008 PDF file not found
2009 No license matching supplied api_code
2010 No label matching supplied user_code
2011 Supplied user_code has expired
2012 Error generating QR code

Examples

Note: When an error occurs, the content type is set to application/json.

Request:

        https://api.uat.nzpost.co.nz/labels/batch.json?api_code=89wyd0&batch_id=bcdfh47fdgsd534

    

Responses:

    
{
  "status_code": "OK"
  "print_url": https://api.uat.nzpost.co.nz/labels/batch.pdf?api_code=89wyd0&batch_id=bcdfh47fdgsd534
}

{
  "status_code": "ERROR",
  "error_code": "2002",
  "error_reason": "PDF Not Ready, try again soon."
}