Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Validator is a script checking the correctness of information being transferred in a structure with the specified syntax (JSON in the case of the POST method or as a parameter in the case of the GET method). In the case of the ShipX platform we conduct several validation variants simultaneously.
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.The data not meeting the validation assumptions

Data that does not fulfil the validation assumptions are not recorded 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

PanelbgColor#f0f0f0titleBGColor#f0f0f0title

.


On this page

Table of Contents
minLevel2
 

Custom Attributes Form

Attribute

Type

Validation

target_point

String

The attribute is

not

required for the following services:
inpost_locker_standard, inpost_locker_allegro, inpost_locker_pass_thru, inpost_letter_allegro.

dropoff_point

String

The attribute is required for the following services:
inpost_locker_pass_thru inpost_letter_allegro.

Attribute is not required,

the

dropoff_point

attribute

 attribute is required together with

the

sending_method

attribute.

 attribute

The above condition is required only for the following values of

the

sending_method

attribute

 attribute (parcel_

_

locker, pok,

 

courier_pok) 

sending_method

String

The attribute

Attribute is not required, acceptable values (parcel_locker, pok, pop, courier_pok, branch, dispatch_order),

possibility to provide an empty attribute.

empty value allowed


Insurance Form

Attribute

Type

Validation

insurance_amount

Decimal

The attribute is

not requiredMinimum 1

required for the following services:
inpost_courier_standard, inpost_courier_express_1000, inpost_courier_express_1200, inpost_courier_express_1700, inpost_courier_palette when passing the COD attribute.

Attribute is not required, greater than or equal to 1, less than 10000000

insurance_currency

String

The attribute

Attribute is not required, default value: PLN


Parcels Simple Form

Attribute

Type

Validation

template

String

Attribute is not required

dimensions

Dimensions Simple Form

The attribute

Attribute is not required, it becomes required when the template  attribute is not provided

.template

String

The attribute is not required

weight

Weight Simple Form

The attribute

Attribute is not required, it becomes required when the template  attribute is not provided

.

id

String

The attribute

Attribute is not required

is_non_standardBoolean

The attribute is not required, default value null

Additional validation:

When providing

When passing a collection of parcels, it is

necessary

required to

provide

pass the id

attribute in the parcel object, if the id attribute is not provided, the user will get the respective message.When providing a collection, it is necessary to provide the id attribute in the parcel object, if the id attribute is not unique within

 attribute. If the id  attribute is not passed, or if it is not unique in scope of the request, the user will

get the respective

receive validation message.

is_non_standard

Boolean

Attribute is not required, default value: null


Dimensions Simple Form

Attribute

Type

Validation

height

Float

The attribute

Attribute is required,

minimum

greater than or equal to 1, less than 1000000,

possibility to provide an empty attribute.

empty value allowed

length

Float

The attribute

Attribute is required,

minimum

greater than or equal to 1, less than 1000000,

possibility to provide an empty attribute.

empty value allowed

width

Float

The attribute

Attribute is required,

minimum

greater than or equal to 1, less than 1000000,

possibility to provide an empty attribute.

empty value allowed

unit

String

The attribute

Attribute is not required, default value: mm


Weight Simple Form

Attribute

Type

Validation

amount

Float

The attribute

Attribute is required,

minimum

greater than or equal to 1, less than 10000000,

possibility to provide an empty attribute.

empty value allowed

unit

String

The attribute

Attribute is not required, default value: kg


Receiver Form

Attribute

Type

Validation

company_name

String

The attribute

Attribute is not required, it becomes required when

the

first_name,last_name

and address attribute is

, address attributes are not provided

.

Maximum

maximum length 255

characters

.

email

String

The attribute

Attribute is

not required, possibility to provide an empty attribute,

required only for parcel

station shipments the

locker shipments, in other cases attribute is not required

.

phone

String

The attribute

Attribute is required. Only 9 digits (333222111)

address

Address Form

The attribute

Attribute is required

.

first_name

String

The attribute

Attribute is not required, it becomes required when

the

company_name, email

and  phone attribute is not provided

, phone attributes are not provided 

last_name

String

The attribute

Attribute is not required, it becomes required when

the

company_name, email

and  phone attribute is not provided

, phone attributes are not provided 


Sender Form

Attribute

Type

Validation

company_name

String

The attribute

Attribute is not required, it becomes required when

the

first_name

and

, last_name

attribute is

attributes are not provided

.

 

email

String

The attribute

Attribute is not required,

possibility to provide an empty attribute.

empty value allowed

phone

String

The attribute

Attribute is required. Only 9 digits (333222111)

address

Address Form

The attribute

Attribute is required

.

first_name

String

The attribute

Attribute is not required, it becomes required when

the

company_name, first_name

or

, last_name

attribute is

attributes are not

provided

provided 

last_name

String

The attribute

Attribute is not required, it becomes required when

the

company_name, first_name

or

, last_name

attribute is

attributes are not provided


Address Form

Attribute

Type

Validation

line1

String

The attribute

Attribute is not required

city

String

The attribute

Attribute is not required

post_code

String

The attribute

Attribute is not required

country_code

String

The attribute

Attribute is not required

street

String

The attribute

Attribute is not required

building_number

String

The attribute

Attribute is not required


Create Address Form

Attribute

Type

Validation

street

String

The attribute

Attribute is required, maximum length 255

characters

, It is a

requirement

condition for attribute validation

is no provision of the

that attributes are not passed line1 / line2

attributes/

  or

provision of the

building_number

attribute

building_number

String

The attribute

Attribute is required, maximum length 255

characters

, It is a

requirement

condition for attribute validation

is no provision of the

that attributes are not passed line1 / line2

attributes/

or

provision of the

street

attribute

line1

String

The attribute

Attribute is required, maximum length 255

characters

, It is a

requirement

condition for attribute validation

is provision of the line2 attribute

that attributes are not passed line2

line2

String

The attribute

Attribute is not required, maximum length 255

characters

city

String

The attribute

Attribute is required, maximum length 255

characters

post_code

String

The attribute

Attribute is required, address format according to the

Polish e-mail address convention e.g. 00-000

address convention of the post office in the user's country

country_code

String

The attribute

Attribute is not required, minimum length 2

characters

, maximum length 3

characters


Cod Form

Attribute

Type

Validation

cod_amount 

Decimal

The attribute

Attribute is not required

. Upon transfer of the data, the system is expecting values from the range from 1 to

, greater than or equal to  1, less than 10000000

cod_currency 

String

The attribute

Attribute is not required, default value: PLN


Shipment Select Offers Form

Attribute

Type

Validation

id

String

The attribute

Attribute is not required

shipment_id

Integer

The attribute

Attribute is required

• Acceptable

, acceptable format Integer

offer_id

Integer

The attribute

Attribute is required

• Acceptable

, acceptable format Integer


Bulk Buy Shipments Form

Attribute

Type

Validation

id 

String

The attribute

Attribute is not required

shipment_id 

Integer

The attribute

Attribute is required

• Acceptable format Integer

offer_id 

Integer

The attribute

Attribute is required

• Acceptable format Integer


Format Parameters Form

Attribute

Type

Validation

field_separator

String

The attribute

Attribute is not required

character_encoding

String

The attribute

Attribute is not required

text_qualifier

String

The attribute

Attribute is not required

sheets_index

Array[Integer]

The attribute

Attribute is not required


Mapping Form

Attribute

Type

Validation

custom_attributes

String

The attribute

Attribute is not required, default value

nil

: null

insurance

String

The attribute

Attribute is not required, default value

nil

: null

cod

String

The attribute

Attribute is not required, default value

nil

: null

additional_services

String

The attribute

Attribute is not required, default value

nil

: null

service

String

The attribute

Attribute is not required, default value

nil

: null

parcels

String

The attribute

Attribute is not required, default value

nil

: null

receiver

String

The attribute

Attribute is not required, default value

nil

: null

sender

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

200 OK

Successful request.

201 CREATED

New resource is created.

204 NO CONTENT

Server successfully processed the request, and is not returning any content.

400 BAD REQUEST

Server cannot process the request. More info in response.

401 UNAUTHORIZED

Proper authorization is required to access this resource.

403 FORBIDDEN

Access to the requested resource is forbidden

404 NOT FOUND

Resource is not found.

500 SERVER ERROR

The server  failed to fulfil a request


Errors

If error occurs, API will return object with following attributes:

Attribute

Type

Description

status

Integer

HTTP status code

error

String

Error key

message

String

Easy to understand description of error.

Note

It may change - do not base on it in your code.

details

Object

Details of the error which occurred.

Response example

Code Block
languagejson
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.

Code Block
languagejson
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"]
	}
} 
Note

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

resource_not_found

404

The resource you are looking for was not found

validation_failed

400

There were validation errors when sending data via POST or PUT. More info in "details".

unauthorized

401

Access to the resource is impossible due to lack of or incorrect access token. 

access_forbidden

403

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

required

, default value nil

Value is required.

invalid

Value is invalid, more info in resource documentation.

too_short

Value is too short, more info in resource documentation.

too_long

Value is too long.

too_small

Value is too small, it concerns to numerical value. 

too_big

Value is too big, it concerns to numerical value.  

invalid_format

Given value has an invalid format, e.g word in phone number field.

Info

Besides the above errors, there may be others, for specific resources. More details in documentation specific to these resources.