ParcelAddress API

(0 reviews)

Search for Address

Resource URL

UAT:

https://api.uat.nzpost.co.nz/parceladdress/2.0/domestic/addresses
Production:
https://api.nzpost.co.nz/parceladdress/2.0/domestic/addresses

Resource Description

Returns a list of suggested domestic addresses for an address fragment.

Resource Information

AttributeDetail
Response FormatJSON
Requires AuthenticationYes
Rate Limited15 calls per second. If rate limit is exceeded, calls will be queued. Calls unprocessed for over 60 seconds will time out.

Please note that all request parameters should be in lower case.

Request Parameters

Field NameDescriptionMandExample
countThe number of matching address records to be returned. Note that the maximum value for the parameter is 10.Yes10
qAddress fragment to search for suggestions. Valid input characters for this parameter include alphanumeric characters and a forward slash ('/'). All other characters will be ignored.Yes151 Vic

Sample Request

https://api.nzpost.co.nz/parceladdress/2.0/domestic/addresses?q=queen&count=5

Business Rules

The following business rules are applied on each /addresses request:

NameDescription
BR001The address fragment (parameter โ€˜qโ€™) must contain at least 4 characters after the leading and following spaces are removed by the API code. If less than 4 characters, an error message will be returned to the requester.
BR002If no count value is provided, a default number of responses is returned. The default is set to 10 records.
BR003If the count value provided is greater than 10 and there are more than 10 addresses matching the address fragment, only 10 address records will be returned to the merchant.

Response Parameters

The following lists the required fields in the /addresses response message.

Field NameDescriptionMandExample
successReturns if request is successfulYestrue
addressesContains array of address objects. The number of object will not exceed the โ€˜Countโ€™ value defined.Yes if success = trueSee Address Object below
message_idUnique identifier for the response messageYes8b93211c-bffb-4ec9-bd1c-790edbd07691

Address Object

The following lists the fields in the address object.

Field NameDescriptionMandExample
full_addressHuman-readable format of the addressYes if success = true151 Victoria Road, Saint Clair, Dunedin 9012
address_idA unique id for representing the addressYes949793
dpidDelivery point identifierNo1376601

Error Response Elements

Field NameDescriptionMandExample
successReturns if request is successfulYesfalse
errorsError object with error detailsYes if success =falseSee Error Object Parameters below
message_idThe unique message identifierYesec608f40-2a8b-11e5-a9c0-025c481d35ef

Error Object Parameters

Field NameDescriptionExample
codeError code where first 3 digits are http status code, last three digits identify error type400002
messageDescription of error codeInvalid Parameter(s)
detailsDescription of specific errorAddress prefix must be at least 4 characters, not including spaces at the beginning or end.

HTTP Status Codes

Note that some error messages are customised for the request, i.e. error code 400 usually will describe what is wrong with the request

CodeMessage
200Success
400Bad request
401Unauthorized
403Forbidden
409Invalid request
500System unavailable

Error Codes

CodeMessage
200001Partial results returned, not all system(s) have responded
200002All sources responded, data may be incomplete
400001Parameter(s) missing
400002Invalid parameter(s)
400003Non mutually exclusive parameters detected
401001Unauthorised access, please contact administrator
500001General Exception
500002System(s) offline

Sample Response

Success Sample:


{
   "success": true,
   "addresses":    [
            {
         "full_address": "392 Ellerslie-Panmure Highway, Mount Wellington, Auckland 1060",
         "address_id": "1670975",
         "dpid": "1376601"
      },
            {
         "full_address": "392E Ellerslie-Panmure Highway, Mount Wellington, Auckland 1060",
         "address_id": "1064190",
         "dpid": "1611011"
      }
   ],
   "message_id": "f01f008a-2a37-429b-8784-b252f56e060a"
}

Failure Sample:


{
   "success": false,
   "errors": [   {
      "code": "400002",
      "message": "Invalid parameter(s)",
      "details": "Address prefix must be at least 4 characters, not including spaces at the beginning or end."
   }],
   "message_id": "28eed9bd-8ea5-4167-85d8-a20d4a5e7a42"
}

Reviews