Offer selection

 

Authentication

Access to the resource requires a valid access token.


Offer selection

POST /v1/shipments/:id/select_offer

Parameters

Parameter

Type

Description

Validation

Parameter

Type

Description

Validation

offer_id

Integer

Offer ID

The attribute is required.

  • The system will return an error in case of an unavailable service, unavailable carrier or unavailable offer.

  • The system will return an error if the offer has already been bought.

Example request

curl -X POST https://api-shipx-pl.easypack24.net/v1/shipments/1/select_offer -H 'Authorization: Bearer token' -H 'Content-Type: application/json' -d '{ "offer_id": 183 }'

Response

HTTP/1.1 200 OK Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/v1/shipments/1", "id": 1, "status": "offer_selected", "tracking_number": null, "service": "inpost_locker_standard", "reference": null, "is_return": false, "application_id": 1, "created_by_id": null, "external_customer_id": null, "sending_method": null, "additional_services": [], "custom_attributes": { "target_point": "KRA010" }, "cod": { "amount": null, "currency": null }, "insurance": { "amount": null, "currency": null }, "sender": { "id": 428, "name": null, "company_name": "Inittec Sp. z o.o. (API Tests)", "first_name": null, "last_name": null, "email": "inittec@inpost.pl", "phone": "121323123", "address": { "id": 434, "street": "Zawiła", "building_number": "65L", "line1": null, "line2": null, "city": "Kraków", "post_code": "30-390", "country_code": "PL" } }, "receiver": { "id": 427, "name": null, "company_name": "Inpost", "first_name": null, "last_name": null, "email": "inpost@sklep.pl", "phone": "888888888", "address": { "id": 433, "street": "Zawila 65L", "building_number": null, "line1": null, "line2": null, "city": "Krakow", "post_code": "30-390", "country_code": "PL" } }, "selected_offer": { "id": 203, "status": "selected", "expires_at": "2017-06-16T11:37:00.063+02:00", "rate": 13.5, "currency": "PLN", "additional_services": [], "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." }, "unavailability_reasons": null }, "offers": [ { "id": 203, "status": "selected", "expires_at": "2017-06-16T11:37:00.063+02:00", "rate": 13.5, "currency": "PLN", "additional_services": [], "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." }, "unavailability_reasons": null } ], "transactions": [], "parcels": [ { "id": 214, "tracking_number": null, "is_non_standard": false, "template": null, "dimensions": { "length": 13, "width": 20, "height": 20, "unit": "mm" }, "weight": { "amount": 1, "unit": "kg" } } ], "created_at": "2017-06-16T11:26:59.418+02:00", "updated_at": "2017-06-16T11:27:54.819+02:00" }

 

Error information

 Server can return the following errors when selecting an offer:

  • validation_failed - validation error

  • resource_not_found - shipment does not exist

  • token_invalid - user has no access to the shipments organization