Body Envelope
Every response is contained in an envelope which means each response has a predictable set of keys with which you can interact.
meta
The meta key helps communicate extra information regarding a response to the developer.
meta
| Key | Type | Optional? | Description | Example |
|---|---|---|---|---|
| code | Number | Up to a 3-digit code that represents the status of the request | 200 | |
| message | String | ✔ | Human-readable description of the specific meta code | The request was successfully processed by AfterShip. |
| details | Error[] | ✔ | Detailed error information to indicate the error in the request. It only exists in error responses. | [] |
Error
| Key | Type | Description | Example |
|---|---|---|---|
| path | String | Error path of the request | data.request_address.postal_code |
| info | String | Human-readable description of the specific error | data.request_address.postal_code is invalid |
Normal Response
{ "meta": { "code": 200, "message": "" "details": [] }, "data": { ... } }
Error
Data
The data key is the meat of the response. It can be in the form of a list of results, but either way, this is where you’ll find the requested data.
Here is an example for Post /addresses/validate
{ "meta": { "code": 200, "message": "OK", "details": [] }, "data": { "status": "valid", "suggested_addresses": [ { "type": "business", "street_1": "123 Main Street", "street_2": "Suite 200", "street_3": null, "street_number": "125", "district": null, "county": "Santa Clara County", "postal_code": "95113", "city": "San Jose", "state": { "name": "California", "code": "US-CA" }, "country_region": { "name": "United States", "code": "USA" }, "coordinate": { "longitude": 37.34, "latitude": -121.89 } } ], "errors": [] } }