Label method
This API returns details about a generated label.
API Details
URL |
HTTP Request Types |
Request Formats |
https://api.nzpost.co.nz/labels/label/ |
GET |
JSON, JSONP, XML, HTML, PDF |
Request Parameters
Parameter |
Description |
Required |
Value |
Maximum Length |
Example |
uuid |
The unique id of the label |
Yes |
String |
|
bcdfh47fdgsd534 |
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 is either 'OK' or 'ERROR' |
String |
Yes |
OK |
status |
The status of generating the label |
String |
No |
NetDespatching |
label_uuid |
The unique id of the generated label |
String |
No |
bcdfh47fdgsd534 |
user_reference_code |
Sender's own unique identifier for this package |
String |
No |
PKG-23478236565 |
details_url |
The url path to json response details |
String |
No |
https://api.nzpost.co.nz/label/bcdfh47fdgsd534.json |
print_url |
The url path to download the pdf label |
String |
No |
https://api.nzpost.co.nz/label/bcdfh47fdgsd534.pdf |
tracking_code |
The tracking code attached to the label |
String |
No |
JD260022817NZ |
error_code |
The error code |
String |
No |
2004 |
error_reason |
An explanation of the error |
String |
No |
Label has been deleted, pdfs retained for only 3 months |
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 |
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.nzpost.co.nz/labels/label/bcdfh47fdgsd534.json
Responses:
{
"status_code": "OK",
"status": "Complete",
"label_uuid": "585acff07ac5012e893f442c03203548",
"user_reference_code":"PKG-6933083665",
"details_url": "https://api.nzpost.co.nz/labels/label/bcdfh47fdgsd534.json",
"print_url": "https://api.nzpost.co.nz/labels/label/bcdfh47fdgsd534.pdf",
"tracking_code": "JD260003490NZ"
}
{
"status_code": "ERROR",
"error_code": "2002",
"error_reason": "PDF Not Ready, try again soon."
}