Form validation
When sending a request, the values provided are subject to validation, ensuring that the transferred data are consistent with the assumptions of the platform receiving the request.
Data that does not fulfil the validation assumptions are not saved by the platform. In such case, the user is informed by a legible return message.
The resource has information concerning validation of the forms used in ShipX.
On this page
- 1 Custom Attributes Form
- 2 Insurance Form
- 3 Parcels Simple Form
- 4 Dimensions Simple Form
- 5 Weight Simple Form
- 6 Receiver Form
- 7 Sender Form
- 8 Address Form
- 9 Create Address Form
- 10 Cod Form
- 11 Shipment Select Offers Form
- 12 Bulk Buy Shipments Form
- 13 Format Parameters Form
- 14 Mapping Form
- 15 HTTP Status codes
- 16 Errors
- 16.1 Error Keys
- 16.2 Validation error keys
Custom Attributes Form
Attribute | Type | Validation |
---|---|---|
| String | The attribute is required for the following services: |
| String | The attribute is required for the following services: Attribute is not required, The above condition is required only for the following values of |
| String | Attribute is not required, acceptable values ( |
Insurance Form
Attribute | Type | Validation |
---|---|---|
| Decimal | The attribute is required for the following services: Attribute is not required, greater than or equal to |
| String | Attribute is not required, default value: PLN |
Parcels Simple Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required |
| Dimensions Simple Form | Attribute is not required, it becomes required when the |
| Weight Simple Form | Attribute is not required, it becomes required when the |
| String | Attribute is not required When passing a collection of parcels, it is required to pass the |
| Boolean | Attribute is not required, default value: |
Dimensions Simple Form
Attribute | Type | Validation |
---|---|---|
| Float | Attribute is required, greater than or equal to 1, less than 1000000, empty value allowed |
| Float | Attribute is required, greater than or equal to 1, less than 1000000, empty value allowed |
| Float | Attribute is required, greater than or equal to 1, less than 1000000, empty value allowed |
| String | Attribute is not required, default value: mm |
Weight Simple Form
Attribute | Type | Validation |
---|---|---|
| Float | Attribute is required, greater than or equal to 1, less than 10000000, empty value allowed |
| String | Attribute is not required, default value: kg |
Receiver Form
Attribute | Type | Validation |
|
|
---|---|---|---|---|
| String | Attribute is not required, it becomes required when maximum length 255. | ||
| String | Attribute is required only for parcel locker shipments, in other cases attribute is not required | ||
| Address Form | Attribute is required | ||
| String | Attribute is not required, it becomes required when | ||
| String | Attribute is not required, it becomes required when | ||
| String | regex | country | digits |
PL: \A(\(?((\+)|00)48\)?) | PL (Poland | 9 digits | ||
FR: \A(\(?((\+)|00)33\)?) | FR (France) | 9 digits | ||
ES: \A(\(?((\+)|00)34\)?) | ES (Spain) | 9 digits | ||
BE: \A(\(?((\+)|00)32\)?) | BE (Belgium) | 8-9 digits | ||
DE: \A(\(?((\+)|00)49\)?) | DE (Germany) | 10-11 digits | ||
LU: \A(\(?((\+)|00)352\)?) | LU (Luxembourg) | 9 digits | ||
PT: \A(\(?((\+)|00)351\)?) | PT (Portugal) | 9 digits | ||
AT: \A(\(?((\+)|00)43\)?) | AT (Austria) | 7-13 digits | ||
GB: \A(\(?((\+)|00)44\)?) | GB (United Kingdom) | 10 digits | ||
IT: \A(\(?((\+)|00)39\)?) | IT (Italy) | 9-10 digits | ||
NL: \A(\(?((\+)|00)31\)?) | NL (Netherlands) | 10 digits | ||
IE: \A(\(?((\+)|00)353\)?) | IE (Ireland) | 10 digits | ||
MC: \A(\(?((\+)|00)377\)?) | MC (Monaco) | 8 digits | ||
CH: \A(\(?((\+)|00)41\)?) | CH (Switzerland) | 9 digits | ||
UA: \A(\(?((\+)|00)380\)?) | UA (Ukraine) | 9 digits | ||
BY: \A(\(?((\+)|00)375\)?) | BY (Belarus) | 9 digits | ||
BG: \A(\(?((\+)|00)359\)?) | BG (Bulgaria) | 8-9 digits | ||
CY: \A(\(?((\+)|00)357\)?) | CY (Cyprus) | 8 digits | ||
CZ: \A(\(?((\+)|00)420\)?) | CZ (Czech Republic) | 9 digits | ||
DK: \A(\(?((\+)|00)45\)?) | DK (Denmark) | 8 digits | ||
EE: \A(\(?((\+)|00)372\)?) | EE (Estonia) | 7-8 digits | ||
FI: \A(\(?((\+)|00)358\)?) | FI (Finland) | 8-10 digits | ||
GR: \A(\(?((\+)|00)30\)?) | GR (Greece) | 10 digits | ||
HU: \A(\(?((\+)|00)36\)?) | HU (Hungary) | 9 digits | ||
LT: \A(\(?((\+)|00)370\)?) | LT (Lithuania) | 8 digits | ||
LV: \A(\(?((\+)|00)371\)?) | LV (Latvia) | 8 digits | ||
MT: \A(\(?((\+)|00)356\)?) | MT (Malta) | 8 digits | ||
SE: \A(\(?((\+)|00)46\)?) | SE (Sweden) | 9 digits |
Sender Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required, it becomes required when |
| String | The attribute is required |
| String | Attribute is required. Only 9 digits (333222111) |
| Address Form | The attribute is required for the following services: inpost_courier_standard, inpost_courier_express_1000, inpost_courier_express_1200, inpost_courier_express_1700, inpost_courier_palette. |
| String | Attribute is not required, it becomes required when |
| String | Attribute is not required, it becomes required when |
Address Form
Attribute | Type | Validation |
---|---|---|
| String | The attribute is not required, the requirement appears when the address attribute is passed Maximum of 255 characters. |
| String | The attribute is not required, the requirement appears when the address attribute is passed Maximum of 255 characters. |
post_code | String | The attribute is not required, the requirement appears when the address attribute is passed Maximum of 255 characters. |
country_code | String | Attribute is required |
street | String | The attribute is not required, the requirement appears when the address attribute is passed Maximum of 255 characters. |
building_number | String | The attribute is not required, the requirement appears when the address attribute is passed Maximum of 255 characters. |
Create Address Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is required, maximum length 255, It is a condition for attribute validation that attributes are not passed |
| String | Attribute is required, maximum length 255, It is a condition for attribute validation that attributes are not passed |
| String | Attribute is required, maximum length 255, It is a condition for attribute validation that attributes are not passed |
| String | Attribute is not required, maximum length 255 |
| String | Attribute is required, maximum length 255 |
| String | Attribute is required, address format according to the address convention of the post office in the user's country |
| String | Attribute is not required, minimum length 2, maximum length 3 |
Cod Form
Attribute | Type | Validation |
---|---|---|
| Decimal | Attribute is not required, greater than or equal to 1, less than |
| String | Attribute is not required, default value: PLN |
Shipment Select Offers Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required |
| Integer | Attribute is required, acceptable format |
| Integer | Attribute is required, acceptable format |
Bulk Buy Shipments Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required |
| Integer | Attribute is required |
| Integer | Attribute is required |
Format Parameters Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required |
| String | Attribute is not required |
| String | Attribute is not required |
| Array[Integer] | Attribute is not required |
Mapping Form
Attribute | Type | Validation |
---|---|---|
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
| String | Attribute is not required, default value: null |
HTTP Status codes
List of HTTP status codes which may occurs in response:
HTTP status code | Description |
---|---|
| Successful request. |
| New resource is created. |
| Server successfully processed the request, and is not returning any content. |
| Server cannot process the request. More info in response. |
| Proper authorization is required to access this resource. |
| Access to the requested resource is forbidden |
| Resource is not found. |
| The server failed to fulfil a request |
Errors
If error occurs, API will return object with following attributes:
Attribute | Type | Description |
---|---|---|
| Integer | HTTP status code |
| String | Error key |
| String | Easy to understand description of error. It may change - do not base on it in your code. |
| Object | Details of the error which occurred. |
Response example
HTTP/1.1 404 Not Found
{
"status": 404,
"error": "resource_not_found",
"message": "Resource you are looking for are not found",
"details: {}
}
In POST or PUT query - validation errors may occur. Details about them are placed in "details" attribute.
HTTP/1.1 400 Bad Request
{
"status": 400,
"error": "validation_failed",
"message": "Data sent by POST or PUT request are not valid. Check details for more info",
"details: {
"name": ["required", "too_short"],
"post_code": ["invalid_format"]
}
}
Names of attributes with validation errors are keys for details object. Their value is a table with error keys which occured. Error keys are described below.
Error Keys
The table below shows the error keys that may occurs with possible HTTP codes.
Error key | HTTP Code | Description |
---|---|---|
|
| The resource you are looking for was not found |
|
| There were validation errors when sending data via POST or PUT. More info in "details". |
|
| Access to the resource is impossible due to lack of or incorrect access token. |
|
| Access to the specified resource is denied due to lack of or incorrect permissions. |
Validation error keys
The table below shows the validation error keys that may occurs in details attribute if validation is failed.
Error key | Description |
---|---|
| Value is required. |
| Value is invalid, more info in resource documentation. |
| Value is too short, more info in resource documentation. |
| Value is too long. |
| Value is too small, it concerns to numerical value. |
| Value is too big, it concerns to numerical value. |
| Given value has an invalid format, e.g word in phone number field. |
Besides the above errors, there may be others, for specific resources. More details in documentation specific to these resources.