Request headers
When performing a request the following headers can be stated
Header | Description |
---|---|
Authorization | Authentication header in which all data related to the authentication are to be sent. The details are described in chapter Authentication. |
X-User-Agent | This header allows the client/platform name and/or other related information to be determined. |
X-User-Agent-Version | This header allows to determine the version of the client/platform making the request. Its content does not affect the functioning of the API. |
X-Request-ID | This header allows to determine the request ID. It is useful in debugging errors and problems that can occur when integrating with the API. Its provision does not affect the functioning of the API. |
Accept-Language | The header allows to change the error message format. Available:
|
Response headers
In the response the server returns the following headers:
Header | Description |
---|---|
X-Request-ID | Request ID. Useful when debugging problems with the API. |
Collections
Collection attributes
Attribute | Type | Description |
---|---|---|
href | String | Absolute URL address to the collection. |
count | Integer | Total number of collection elements. |
page | Integer | Current collection results page. |
per_page | Integer | Number of results (per page) returned in the response. |
items | Array | Collection elements. |
Collection example in the JSON format:
{ "href": "https://api-pl-shipx.easypack24.net/v1/points", "count": 1024, "page": 10, "per_page": 100, "items": [ { "href": "https://api-shipx-pl.easypack24.net/v1/points/KRA010", "id": "KRA010", ... other resource's params ... } ] }
Paging
Collections support paging (unless stated otherwise in the documentation applicable to the resource).
Scrolling on the subsequent collection pages is by providing parameters in the request (page) and/or (page_page). Sample request:
GET /v1/points?page=10 HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json
Test environment
Test environment address: https://sandbox-api-shipx-pl.easypack24.net
To receive an authorization token for api ShipX, use the form at the link: https://inpost.pl/formularz-wsparcie
Authorization
All requests sent to the server require provision of the right and valid access token which is property of the particular owner in the organization.
The access token should be provided in the Authorization header.
Sample request:
GET /v1/users HTTP/1.1 Host: api-shipx-pl.easypack24.net Content-Type: application/json Authorization: Bearer W-TYM-MIEJSCU-NALEZY-UMIESCIC-TOKEN
Errors
Sample error
HTTP/1.1 400 Bad Request Content-Type: application/json { "status": 400, "error": "invalid_parameter", "description": "Passed unsupported value (value of the parameter here) to parameter (parameter name)", "details": null }
A list of error keys that can occur is provided below.
Key | Description |
---|---|
resource_not_found | The resource being sought has not been found. |
access_forbidden | Access to the particular resource is forbidden. |
invalid_parameter | An incorrect value has been provided for the particular parameter in the URI. Details available under the error response description key. |
validation_failed | Validation error. The data sent in the request body with the POST method are incorrect. The error details included in the response under the details key See the validation error example below. |
offer_expired | The offer cannot be purchased, as its validity term has expired. |
Sample validation_failed error
HTTP/1.1 400 Bad Request Content-Type: application/json { "status": 400, "error": "validation_failed", "description": "Some of data sent in payload are invalid. Check details for more information.", "details": { "email": ["invalid"] } }
In this case, Obit details contains a collection in which the keys correspond to the names of the parameters sent in the request body, while the values is a table with keys specifying the validation errors that have occurred for the particular parameter.
Possible validation errors are:
Validation error | Description |
---|---|
required | The value for the particular parameter is required. |
too_short | Too low number of characters. Check the details in the documentation for the particular resource. |
too_long | Too high number of characters. Check the details in the documentation for the particular resource. |
not_a_number | The entered value should be a number. |
not_an_integer | The entered value should be an integer. |
invalid | The entered value is incorrect. Check the details in the documentation for the particular resource. |