Shipment edit

Shipment editing rules:

  • All attributes described in Shipment creation can be edited. 

  • Only non bought shipments can be edited, namely ones in the following statuses: createdoffers_prepared or offer_selected.

  • It is possible to edit a shipment created in simplified mode if it wasn't bought, e.g. if there were no offers

  • Shipments cannot be updated during offer downloading or during buy processing.

  • Editing a shipment will result in offer recalculation - old offers will be removed and new ones will replace them.

  • It is possible to delete values sent during shipment creation by sending null value in it's place


Authentication

Access to the resource requires a valid access token.




Shipment Edit

The operation allows for editing the shipment information. 

Attention! Debit Clients

After editing a shipment we do not return prices for debit clients. The rate attribute is null.

 

PUT /v1/shipments/:id

Example request

curl -X PUT https://api-shipx-pl.easypack24.net/v1/shipments/1 -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{ "mpk":"miejsce_powstania_kosztow", "comments": "dowolny komentarz",   "external_customer_id": "8877xxx", "receiver": { "company_name": "Some company inc.", "first_name": "John", "last_name": "Due", "name": "Nazwa", "email": "john@due.com", "phone": "456123789", "address": { "id": "123", "street": "Santa st", "building_number": "130",  "city": "New York", "post_code": "44-556", "country_code": "PL" } }, "sender": { "name": "Nazwa", "company_name": "Some company inc.", "first_name": "John", "last_name": "Due", "email": "john@due.com", "phone": "321654987", "address": { "id": "123", "street": "Santa st", "building_number": "130",  "city": "New York", "post_code": "33-333", "country_code": "PL" } }, "cod": { "amount": "132", "currency": "PLN" }, "reference": "69854156", "is_return": true, "only_choice_of_offer":true, "parcels": [ { "id": "small package", "template": "small", "dimensions": { "length": "80", "width": "360", "height": "640", "unit": "mm" }, "weight": { "amount": "25", "unit": "kg" } } ], "insurance": { "amount": "33", "currency": "PLN" }, "custom_attributes": { "allegro_transaction_id": "98754641", "allegro_user_id": "98757" }, "mpk": "Nazwa miejsca powstania kosztów." }'

 

Response

{     "href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/shipments/1",     "id": "1",     "status": "offers_prepared",     "parcels": [         {             "id": "small package",             "template": "small",             "dimensions": {                 "length": "80",                 "width": "360",                 "height": "640",                 "unit": "mm"             },             "weight": {                 "amount": "25",                 "unit": "kg"             },             "tracking_number": null,             "is_non_standard": false         }     ],     "custom_attributes": {         "target_point": "KRA010",         "dropoff_point": null,         "sending_method": "parcel_locker",         "dispatch_order_id": 1     },     "sender": {         "id": "123",         "name": "Nazwa",         "company_name": "InPost S.A.",         "first_name": "Jan",         "last_name": "Nowak",         "email": "sender@email.com",         "phone": "888000000",         "address": {             "id": "123",             "street": "Malborska",             "building_number": "130",             "city": "Kraków",             "post_code": "30-624",             "country_code": "PL"         }     },     "receiver": {         "id": "123",         "name": "Nazwa",         "company_name": null,         "first_name": null,         "last_name": null,         "email": "sender@email.com",         "phone": "888000000",         "address": null     },     "created_at": "2015-09-06T19:21:00.000+02:00",     "cod": {         "amount": 12.50,         "currency": "PLN"     },     "insurance": {         "amount": 25,         "currency": "PLN"     },     "additional_services": [],     "reference": "Order No. 12345",     "is_return": false,     "tracking_number": null,     "created_by_id": 3,     "offers": [         {             "id": 1278,             "carrier": {                 "id": "inpost_locker",                 "name": "InPost Paczkomaty",                 "description": "InPost Paczkomaty - Przesyłki paczkomatowe."             },             "service": {                 "id": "inpost_locker_standard",                 "name": "Paczkomatowa Standardowa",                 "description": "Przesyłka paczkomatowa standardowa."             },             "status": "available",             "expires_at": "2015-09-06T19:21:00.000+02:00",             "rate": 2.02,             "currency": "PLN",             "unavailability_reasons": null         }     ],     "selected_offer": null,     "transactions": [],     "sending_method": "parcel_locker",     "external_customer_id": "8877xxx",   }

 

Error information

Errors that may appear while editing a shipment:

  • resource_not_found - shipment doesn't exist or the user has no access to it,

  • invalid_action - appears when trying to edit an already bought shipment (confirmed status or later),

  • shipment_locked - appears for shipments for which the offers calculation process hasn't been completed yet (or another operation is performed on the shipment).

  • forbidden - the token used does not have authorization to perform the action.