Versions Compared

Key

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

We allow additional comments to be provided for an existing collection order. In addition, we allow updates of a comment assigned to a particular collection order.

We allow additional comments to be provided for an existing collection order. In addition, we allow updates of a comment assigned to a particular collection order.

Sample request

Creating a collection order, we allow an optional comment to be provided.
In addition, we allow other comments to be added to an already existing collection order.

Collection orders allow for ordering a courier visit in order to collect an earlier prepared shipment.

Every collection order has a status which determines its condition. The statuses supported are:

• new - a new collection order which has not been transferred to processing yet,
• sent - the collection order has been transferred to processing, but has not been accepted yet,
• accepted - the order has been accepted for processing by the courier,
• done - the collection order has been completed,
• rejected - the collection order has been rejected by the courier,
• canceled - the order has been canceled,

Panel
bgColor#f0f0f0
titleBGColor#f0f0f0
titleOn this page

Table of Contents
minLevel2
 

The DispatchOrder resource has the following attributes:

AttributeType

Description

hrefstring

URI to the resource.

idstring

Collection order ID. Read-only.

statusstring

Collection order status.

created_atTime

Collection order creation time.

addressObject

Address which the collection is to be made from.

shipmentsArray[Shipment]

Table of shipments the collection order applies to. The Shipment object contains the attributes:

• href - shipment's URI address,

• id - shipment's ID,

• tracking_number - shipment's tracking number.

commentstring

Optional comment to the collection order

Sample DispatchOrder resource in the JSON format:

Code Block
{
	"href": "https://api-shipx-pl.easypack24.net/v1/dispatch_orders/1",
	"id": 1,
	"status": "sent",
	"address": {
		"id": "123",
		"street": "Malborska",
    	"building_number": "130",
		"post_code": "30-624",
		"city": "Kraków",
		"country_code": "PL",
	},
	"shipments": [
        {
          "href": "https://api-shipx-pl.easypack24.net/v1/shipments/8",
          "id": 8,
          "tracking_number": "622111081631876319900026"
        }
    ],
	"comments": [
        {
		 "24",	
		 "comment": "Some Test Comment",
         "created_at": "2018-02-14T11:37:07.852+01:00"
        }
    ],
	"created_at": "2018-02-14T11:37:07.843+01:00",
    "updated_at": "2018-02-14T11:37:08.340+01:00"
}

Authentication

Access to the resource and its methods requires provision of the correct and valid access token.

Info
titleNote! Debit clients

After creating a collection order, we do not return prices for debit clients.
The price attribute takes the null value

Creating a new collection order

code

DispatchOrders allow ordering courier to collect shipments from the client.

Each DispatchOrder has status, which describing it's state. Available statuses:

  • new - new order, which is not yet passed to execution

  • sent - order is passed to execution, but is not yet accepted


On this page

Table of Contents

Structure

DispatchOrder resource has the following attributes:

Attribute

Type

Description

id

String

ID number (read-only)

status

String

Order status

created_at

DateTime

Timestamp describing when order was created

address

Address

Address, where courier will take over shipments

shipments

Array[Shipment]

Array of shipments that will be taken by the courier. Required Shipment attributes:

  • href - shipment's url address

  • id - shipment's id

  • tracking_number - shipment's tracking number

comment 

String

Optional comments for the DispatchOrder

Example of DispatchOrder resource in JSON format:

Code Block
languagejson
{
	"href": "https://api-shipx-pl.easypack24.net/v1/dispatch_orders/1",
	"id": 1,
	"status": "sent",
	"address": {
		"id": "123",
		"street": "Tottenham Court Road",
    	"building_number": "14",
		"post_code": "W1T 1JY",
		"city": "London",
		"country_code": "GB"
	},
	"shipments": [
        {
          "href": "https://api-shipx-pl.easypack24.net/v1/shipments/8",
          "id": 8,
          "tracking_number": "622111081631876319900026"
        }
    ],
	"comments": [
        {
		 "24",	
		 "comment": "Some Test Comment",
         "created_at": "2018-02-14T11:37:07.852+01:00"
        }
    ],
	"created_at": "2018-02-14T11:37:07.843+01:00",
    "updated_at": "2018-02-14T11:37:08.340+01:00"
}

Authorization

Resource require providing correct access token.


Creating new DispatchOrder

DispatchOrder for specific address

Generating of DispatchOrder require providing correct address using address attribute.

Using data from address, algorithm is calculating checksum, so it is very important to provide correct address without typos etc.

Later, this checksum is used to determine if this DispatchPoint is already registered in our database. If not, a new DispatchPoint is generated (only for locker's shipments).

Next, DispatchPoint found or generated this way is assigned to DispatchOrder for the courier, allowing order execution.

Info

Asynchronous operation, to get the order number use https://dokumentacja-inpost.atlassian.net/wiki/spaces/PL/pages/18153482#DispatchOrder-details, the order number is in the "external_id" parameter.

Info

Warning! Debit clients

We are not showing prices after creation of DispatchOrder, for debit clients.

price attribute will be returned as null.


Code Block
languagejson
POST /v1/organizations/:
org
organization_id/dispatch_orders
Parameters

Sample request

Code BlockPOST /v1/organizations/:org_id/dispatch_orders HTTP/1.1 Host: api-shipx-pl.easypack24.net

Available parameters:

Parameter

Type

Description

Validation

dispatch_point_idinteger

ID of the dispatch point which the shipment is to be collected from (the dispatch point address will become the collection order address).

The attribute is not required.

It is required when the address attribute is not provided

shipmentsArray

List of shipment IDs which the collection order is to be created for.

The attribute is required.

•    The parcels must be in the confirmed status and cannot be assigned to a different collection order in the new, sent, accepted or done status.

• In addition, they must be parcels from the same carrier.

• It is not possible to create one collection order for allegro and other shipments.

• Shipments can be either for allegro, or any other.         

commentstring

Optional comment to the collection order

The attribute is not required to create a collection order.

It becomes required when creating a comment to an already existing collection order.

addressAddressForm

Collection order address

The attribute is not required.

It is required when the dispatch_point_id attribute is not provided

office_hoursstring

Point working hours

The attribute is not required.

Determines the point's working hours, if we create a collection order for an address.

namestringPoint name. Used to create a dispatch point.The attribute is not required.phonestringTelephone contact. Used to create dispatch_point.The attribute is not required.emailstringE-mail contact. Used to create dispatch_point.The attribute is not required.

shipments

Array

List of shipments ids, for which DispatchOrder is being generated.

Attribute is required.

  • Shipments must be in confirmed status and can't be assigned to any other DispatchOrder

  • These must be shipments created using the InPost parcel lockers services or only using the InPost Courier services.

comment

String

Optional comment

The attribute is not required for creating DispatchOrder.

But is required when DispatchOrder is updated.

address

Address

Address of pick-up point (DispatchPoint)

Attribute is required.

office_hours

String

Describing time when DispatchPoint is available for picking up shipments.

Attribute is not required.

name 

String

Name used for generating new DispatchPoint in our database.

Attribute is required.

phone

String

Phone number used for generating DispatchPoint.

Attribute is required.

email 

String

Email address used for generating DispatchPoint.

Attribute is not required.

Example request:

Code Block
languagejson
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders -H 'Authorization: Bearer token' -H 'Content-Type: application/json' 
Authorization: Bearer lkfjasd9f70y43ohriw...[ommited for brevity]...  
-d '{
	"shipments": ["1", "2"],
	"comment": "Dowolny komentarz do zlecenia odbioru",
	"name": "Przykładowa nazwa DispatchPoint",
 	"phone": "505404202",
	"email": "sample@email.com",
	
	"address": {
        "street": "Malborska",
        "building_number": "130",
        "city": "Krakow",
        "post_code": "31-209",
        "country_code": "PL"
    }
 
}'
Response

Example response

Code Block
languagejson
HTTP/1.1 201 Created
Content-Type: application/json
 
{
	"href": "https://api-shipx-pl.easypack24.net/v1/dispatch_orders/1",
	"id": 1,
	"status": "sent",
	"address": {
		"id": "123",
		"street": "Malborska",
    	"building_number": "130",
		"post_code": "30-624",
		"city": "Kraków",
		"country_code": "PL",
	},
	"shipments": [
        {
          "href": "https://api-shipx-pl.easypack24.net/v1/shipments/8",
          "id": 8,
          "tracking_number": "622111081631876319900026"
        }
    ],
	"comments": [
        {
		 "id": 24,	
		 "comment": "Dowolny komentarz do zlecenia odbioru",
         "created_at": "2018-02-14T11:37:07.852+01:00"
        }
    ],
	"created_at": "2018-02-14T11:37:07.843+01:00",
    "updated_at": "2018-02-14T11:37:08.340+01:00"
}

Shipments collection order for address

Generation of an order for an address makes the address necessary to be provided by the address attribute Address object

The system generates the checksum from the information provided, attention has to be paid to ensure that the address is exact and without errors (the so-called typographic errors)

Based on the checksum, the system verifies whether a dispatch point with the same address exists in the database, if not, a new dispatch point is automatically generated (applies only to parcel station shipments).

The collection order (DispatchOrder) is executed to the newly generated dispatch point (DispachPoint).

Errors

• validation_failed - data sent by the user are incorrect, e.g. the stated dispatch point or any of the shipments has an incorrect status
• invalid_range - an incorrect shipment ID range has been provided, the range is not within the range of Integer values
• dispatch_point_and_address_cannot_be_mixed - It is not allowed to simultaneously assign collection orders for an address and a dispatch point id

Collecting information about a collection order

Code Block
GET /v1/dispatch_orders/:order_id

Sample request

Code BlockGET /v1/dispatch_orders/1 HTTP/1.1 Host:

Warning

Possible Errors

  • validation_failed - provided data are incorrect, e.g DispatchPoint not exist or one of shipments is in incorrect status

  • invalid_range - invalid shipment id, e.g range of the id is not matching Integer type

  • dispatch_point_and_address_cannot_be_mixed - address and dispatch_point_id can't be provided at the same time 

  • already_dispatched - means that an order has been created for at least one shipment indicated in the request

  • various_types_of_carrie - means that at least one shipment is of a different service category. These must be shipments created using the InPost parcel lockers services or only using the InPost Courier services.


DispatchOrders list


DispatchOrders list for specific organization can be accessed by using this endpoint:

Code Block
languagejson
GET /v1/organizations/:organization_id/dispatch_orders

Example request:

Code Block
languagejson
curl -X GET https://api-shipx-pl.easypack24.net
Content-Type: application/json
/v1/organizations/1/dispatch_orders -H 'Authorization: Bearer 
lkfjasd9f70y43ohriw...[ommited for brevity]...

Response

Code Block
token' -H 'Content-Type: application/json'

Example response:

Code Block
languagejson
HTTP/1.1 200 OK
Content-Type: application/json
 {
	"href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders
/1
",
	"
id
count": 
1
15,
	"
status
per_page": 
"sent"
30,
	"
address
page": 
{
1,
	"
id
created_at": "
123
2016-03-21T10:13:58.625+01:00",
	
"
street
items": 
"Malborska", "building_number": "130", "post_code
[
		{
			"href": "
30-624
https://api-shipx-pl.easypack24.net/v1/dispatch_orders/3",
			"
city
id": 
"Kraków"
123,
			
"country_code": "PL", }, "shipments": [ { "href": "https://
... other attribute omitted for brevity ....
		}
		... other items omitted for brevity ...
	]
}

Warning

Possible Errors:

  • resource_not_found - organization with this ID not exist

  • forbidden - this is not valid token for this organization


DispatchOrder details

Code Block
languagejson
GET /v1/dispatch_orders/:id

Example request

Code Block
languagejson
curl -X GET https://api-shipx-pl.easypack24.net/v1/
shipments/8", "id": 8,
dispatch_orders/1 -H 'Authorization: Bearer token' -H 'Content-Type: application/json'

Example response

Code Block
languagejson
HTTP/1.1 200 OK
Content-Type: application/json
 {
    "
tracking_number
href": "
622111081631876319900026"
https://api-shipx-pl.easypack24.net/v1/dispatch_orders/3223738",
    
}
"id": 3223738,
   
],
 
"
comments
status": 
[
"sent",
    "external_id": 2003222292,
  
{
 
 "
id
price": 
24,  "comment": "Dowolny komentarz do zlecenia odbioru",
null,
    "address": {
        "
created_at
id": 
"2018-02-14T11:37:07.852+01:00"
1192036131,
        "street": "Malborska",
  
}
     
],
 
"
created
building_
at
number": "
2018-02-14T11:37:07.843+01:00
130",
    
"updated_at": "2018-02-14T11:37:08.340+01:00" } }

Errors

  • resource_not_found - in the event that the order with the stated ID is not found.

Removing a collection order

A collection order can only be deleted when it has new or sent status.

Code Block
DELETE /v1/dispatch_orders/1

Sample request

Code Block
DELETE /v1/dispatch_orders/1 HTTP/1.1
Host: api-shipx-pl.easypack24.net
Content-Type: application/json
Authorization: Bearer lkfjasd9f70y43ohriw...[ommited for brevity]...

Response

Code Block
HTTP/1.1 204 No Content
Content-Type: application/json

Errors

  • resource_not_found - in the event that the order with the stated ID is not found,
  • invalid_status - in the event that the order with the stated ID is in a different status than new or sent,

List of collection orders

The collection orders list within the given organization can be collected at:

Code Block
GET /v1/organizations/:organization_id/dispatch_orders

Sample request

Code Block
GET /v1/organizations/12345/dispatch_orders HTTP/1.1
Host: api-shipx-pl.easypack24.net
Content-Type: application/json
Authorization: Bearer lkfjasd9f70y43ohriw...[ommited for brevity]...

In reply to a correctly sent request, the server will return a response with HTTP 200 OK code:

Code BlockHTTP/1.1 200 OK Content-Type: application/json   { "href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders", "count": 15, "per_page": 30, "page": 1, "created_at": "2016-03-21T10:13:58.625+01:00", "items": [ { "href": "
    "line1": null,
        "line2": null,
        "city": "Krakow",
        "post_code": "31-209",
        "country_code": "PL"
    },
    "statuses": [],
    "shipments": [
        {
            "href": "https://api-shipx-pl.easypack24.net/v1/shipments/793374228",
            "id": 793374228,
            "tracking_number": "602677358231630337744964"
        }
    ],
    "comments": [
        {
            "id": 3198262,
            "comment": "Dowolny komentarz do zlecenia odbioru",
            "created_at": "2022-05-27T10:15:31.765+02:00"
        }
    ],
    "created_at": "2022-05-27T10:15:31.756+02:00",
    "updated_at": "2022-05-27T10:15:32.122+02:00"
}
Warning

Possible Errors

  • resource_not_found - when DispatchOrder with this id not exist


Deleting Dispatch Orders

Dispatch order Can be deleted in the following statuses only: new, sent 

Code Block
languagejson
DELETE /v1/dispatch_orders/:id

Example request

Code Block
languagejson
curl -X DELETE https://api-shipx-pl.easypack24.net/v1/dispatch_orders/
3", "id": 123, ... other attribute omitted for brevity .... } ... other items omitted for brevity ... ] }Errors that may occur when collecting the collection orders list:
1 -H 'Authorization: Bearer token' -H 'Content-Type: application/json'

Response

Code Block
languagejson
HTTP/1.1 204 No Content
Content-Type: application/json

Warning

Error information

  • resource_not_found

 

  • -

the organization which the user wants to collect the collection orders list for does not exist,
  • forbidden - the token does not authorize to collect the collection orders list for the selected organization..
  • Creating a comment to a collection order

    Creating a collection order, we allow an optional comment to be provided.

    In addition, we allow other comments to be added to an already existing collection order.code

    • Dispatch Order with the given ID cannot be found,

    • invalid_status - In case when the Dispatch Order is in a status other than new or sent 


    Creating Dispatch Order comment

    When creating a dispatch order, we allow adding additional comments.

    Additionally, we allow creating a comment for an already existing Dispatch Order. 

    Code Block
    languagejson
    POST /v1/organizations/:organization_id/dispatch_orders/:dispatch_order_id/comment
    Sample request

    Request example

    Code Block
    languagejson
    curl -X POST https://api-shipx-pl.easypack24.net//v1/organizations/
    :organization_id
    1/dispatch_orders/
    :dispatch_order_id
    1/comment 
    HTTP/1.1 Host: api-shipx-pl.easypack24.net
    -H 'Authorization: Bearer token' -H 'Content-Type: application/json' 
    Authorization: Bearer lkfjasd9f70y43ohriw...[ommited for brevity]...  
    -d '{
    	"comment": "Dodatkowy dowolny komentarz do zlecenia odbioru
    " }

    In reply to a correctly sent request, the server will return a response with HTTP 201 Created code:

    code
    "
    }'

    Response

    Code Block
    languagejson
    HTTP/1.1 201 Created
    Content-Type: application/json
     
    {
        "id": 37,
        "href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders/17/comment",
        "comment": "
    To
    Dodatkowy 
    jest
    dowolny 
    jakis
    komentarz 
    nastepny
    do 
    testowy
    zlecenia 
    komentarz
    odbioru",
        "created_at": "2018-02-15T10:32:31.345+01:00"
    }

    Updating a comment to a collection order

    We allow additional comments to be provided for an existing collection order.

    In addition, we allow updates of a comment assigned to a particular collection order.

    code

    Editing Dispatch Order comments

    When creating a dispatch order, we allow adding additional comments.

    Additionally, we allow editing a comment for an already existing Dispatch Order. 

    Code Block
    languagejson
    PUT /v1/organizations/:organization_id/dispatch_orders/:dispatch_order_id/comment
    Sample request

    Request example

    Code Block
    languagejson
    curl -X PUT https://api-shipx-pl.easypack24.net/v1/organizations/
    :organization_id
    1/dispatch_orders/
    :dispatch_order_id
    1/comment 
    HTTP/1.1 Host: api-shipx-pl.easypack24.net
    -H 'Authorization: Bearer token' -H 'Content-Type: application/json' 
    Authorization: Bearer lkfjasd9f70y43ohriw...[ommited for brevity]...  
    -d '{
    	"id": 37,
    	"comment": "Aktualizacja komentarza"
    }

    In reply to a correctly sent request, the server will return a response with HTTP 201 Created code:

    code

    Response

    Code Block
    languagejson
    HTTP/1.1 201 Created
    Content-Type: application/json
    
     
    {
        "id": 37,
        "href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/dispatch_orders/17/comment",
        "comment": "Aktualizacja komentarza",
        "created_at": "2018-02-15T10:32:31.345+01:00"
    }
    Errors that may occur when collecting the collection orders list:

    Warning

    Error information

    • resource_not_found

     - the organization which the user wants to collect the collection orders list for does not exist,
  • forbidden - the token does not authorize to collect the collection orders list for the selected organization.
  • Delete comment to the dispatch order

    For the existing dispatch order, we provide option of delete additional comments.

    Code Block

    • - Dispatch Order with the given ID cannot be found or Organization with the given ID cannot be found.

    • forbidden - Token does not allow for editing Dispatch Order comments for the given organization.


    Deleting Dispatch Order comment

    We allow deleting a comment for an already existing Dispatch Order.

    Code Block
    languagejson
    DELETE /v1/organizations/:organization_id/dispatch_orders/:dispatch_order_id/comment

    Request example

    Code Block
    languagejson
    curl -X DELETE 
    /v1/organizations/:organization_id/dispatch_orders/:dispatch_order_id/comment HTTP/1.1 Host:
    https://api-shipx-pl
    .easypack24.net Content-Type: application/json
    .easypack24.net/v1/organizations/1/dispatch_orders/1/comment -H 'Authorization: Bearer 
    lkfjasd9f70y43ohriw...[ommited for brevity]...   { "comment_ids": [20,21] }

    In response to a request sent correctly, the server returns the response with code HTTP 200 OK:

    Code Block
    token' -H 'Content-Type: application/json'

    Response

    Code Block
    languagejson
    HTTP/1.1 201 Created
    Content-Type: application/json
     
    {
      
      "href": "https://api-shipx-pl.easypack24.net/v1/dispatch_orders/2",
      
      "id": 2,
      
      "status": "sent",
        
    "external_id": 2000000001,
        
    "price": null,
        
    "address": {
          
      
    "id": 211,
          
      
    "street": "Malborska",
        
        "building_number": "130",
          
      "line1": null,
            
    "line2": null,
            
    "city": "Krakow",
          
      "post_code": "31-209",
            
    "country_code": "PL"
        
    },
      
      "statuses": [],
      
      "shipments": [
            
    {
    
                "href": "https://api-shipx-pl.easypack24.net/v1/shipments/103",
                
    "id": 103,
                
    "tracking_number": "520000017830390003050784"
          
      
    }
        
    ],
      
      
    "comments": [
          
      {
              
      "id": 24,
    
              
      "comment": "Test 22",
                
    "created_at": "2018-05-15T11:34:54.119+02:00"
            
    },
          
      
    {
              
      "id": 23,
                
    "comment": "Test 21",
        
            "created_at": "2018-05-15T11:34:51.438+02:00"
          
      },
            
    {
              
      "id": 22,
                
    "comment": "Test 20",
              
      
    "created_at": "2018-05-15T11:34:48.637+02:00"
          
      
    }
      
      ],
    
        "created_at": "2018-05-15T09:19:32.317+02:00",
        
    "updated_at": "2018-05-15T09:19:32.448+02:00"
    }

    The errors that can occur while retrieving the list of receiving orders:

  • resource_not_found - organization for which the user wants to get a list of dispatch orders, does not exist,
  • forbidden - the token does not entitle the user to get the list of dispatch orders for the selected organization.