Zasób Batch
posiada następujące atrybuty:
Atrybut | Typ | Opis |
---|---|---|
id | Integer | Id obiektu |
status | String | Status przetwarzania przesyłek |
shipments | Array[Shipment ] | Przesyłki |
created_at | DateTime | Data utworzenia |
updated_at | DateTime | Data aktualizacji |
Przykład zasobu Batch
w formacie JSON:
{ "href": "https://api-shipx-pl.easypack24.net/v1/batches/16", "id": 16, "status": "done", "shipments": [ { "href": "https://api-shipx-pl.easypack24.net/v1/shipments/151", "id": 151, "status": "confirmed", "tracking_number": "633100159730624319900067" }, { "href": "https://api-shipx-pl.easypack24.net/v1/shipments/150", "id": 150, "status": "confirmed", "tracking_number": "633100159730624319900068" } ], "created_at": "2017-06-08T14:17:25.675+02:00", "updated_at": "2017-06-08T14:17:25.675+02:00" }
Uwierzytelnianie
Dostęp do zasobu wymaga podania prawidłowego i aktualnego access tokenu.
Uwaga! Klienci debetowi
Po utworzeniu przesyłki, nie zwracamy cen dla klientów debetowych.
rate
przyjmuje wartość null
Tworzenie wielu przesyłek
POST /v1/organizations/:organization_id/batches
Parametry
Parametr | Typ | Opis | Walidacja | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
only_choice_of_offer | Boolean | Ustawienie parametru na | Atrybut nie jest wymagany.
| |||||||||
shipments | Array[Hash] |
| Atrybut nie jest wymagany.
|
Przykład zapytania
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/batches -H 'Authorization: Bearer token' -H 'content-type: application/json' -d '{ "only_choice_of_offer": false, "shipments": [ { "id": 1, "service": "inpost_locker_standard", "reference": "Test", "custom_attributes": { "target_point": "KRA012" }, "parcels":{ "template": "small" }, "receiver": { "company_name": "Company name 1", "email": "sklep@inpost.pl", "phone": "888888888", "address": { "line1": "Zawila 65L", "city": "Krakow", "post_code": "30-390", "country_code": "PL" } }, "sender": { "company_name": "Company name 2", "email": "sklep@inpost.pl", "phone": "999999999", "address": { "line1": "Zawila 65L", "city": "Krakow", "post_code": "30-390", "country_code": "PL" } }, "cod": { "amount": 1, "currency": "PLN" }, "insurance": { "amount": 23, "currency": "PLN" } }, { "id": 2, "service": "inpost_locker_standard", "reference": "Test", "custom_attributes": { "target_point": "KRA012" }, "parcels":{ "template": "small" }, "receiver": { "company_name": "Company name 1", "email": "sklep@inpost.pl", "phone": "888888888", "address": { "line1": "Zawila 65L", "city": "Krakow", "post_code": "30-390", "country_code": "PL" } }, "sender": { "company_name": "Company name 2", "email": "sklep@inpost.pl", "phone": "999999999", "address": { "line1": "Zawila 65L", "city": "Krakow", "post_code": "30-390", "country_code": "PL" } }, "cod": { "amount": 1, "currency": "PLN" }, "insurance": { "amount": 23, "currency": "PLN" } } ] }'
curl -X POST https://api-shipx-pl.easypack24.net/v1/organizations/1/batches -H 'Authorization: Bearer token' -H 'content-type: application/json' -d '{ "only_choice_of_offer": false, "shipments": [ { "id": 1, "service": "inpost_locker_standard", "reference": "Test", "custom_attributes": { "target_point": "KRA012" }, "parcels":{ "template": "small" }, "receiver": { "name": "Name", "company_name": "Company name", "first_name": "Jan", "last_name": "Kowalski", "email": "receiver@example.com", "phone": "888000000", "address": { "street": "Cybernetyki", "building_number": "10", "city": "Warszawa", "post_code": "02-677", "country_code": "PL" } }, "sender": { "name": "Nazwa", "company_name": "InPost S.A.", "first_name": "Jan", "last_name": "Nowak", "email": "sender@email.com", "phone": "888000000", "address": { "street": "Malborska", "building_number": "130", "city": "Kraków", "post_code": "30-624", "country_code": "PL" } } }, { "id": 2, "service": "inpost_locker_standard", "reference": "Test", "custom_attributes": { "target_point": "KRA012" }, "parcels":{ "template": "small" }, "receiver": { "name": "Name", "company_name": "Company name", "first_name": "Jan", "last_name": "Kowalski", "email": "receiver@example.com", "phone": "888000000", "address": { "street": "Cybernetyki", "building_number": "10", "city": "Warszawa", "post_code": "02-677", "country_code": "PL" } }, "sender": { "name": "Nazwa", "company_name": "InPost S.A.", "first_name": "Jan", "last_name": "Nowak", "email": "sender@email.com", "phone": "888000000", "address": { "street": "Malborska", "building_number": "130", "city": "Kraków", "post_code": "30-624", "country_code": "PL" } } } ] }'
Odpowiedź
HTTP/1.1 201 Created Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/v1/batches/1672413", "id": 1672413, "status": "in_progress", "shipments": [], "created_at": "2021-08-11T13:12:50.325+02:00", "updated_at": "2021-08-11T13:12:50.325+02:00" }
Informacje o błędach
Serwer może zwrócić następujące błędy
validation_failed
- błąd walidacjiforbidden
- akcja jest niedostępna dla podanego tokenutoken_invalid
- użytkownik nie ma praw dostępu do określonej organizacji
Podgląd wielu przesyłek
GET /v1/batches/:id
Przykład zapytania
curl -X GET https://api-shipx-pl.easypack24.net/v1/batches/16 -H 'Authorization: Bearer token' -H 'content-type: application/json'
Odpowiedź
HTTP/1.1 200 OK Content-Type: application/json { "href": "https://api-shipx-pl.easypack24.net/v1/batches/16", "id": 16, "status": "done", "shipments": [ { "href": "https://api-shipx-pl.easypack24.net/v1/shipments/151", "id": 151, "status": "confirmed", "tracking_number": "633100159730624319900067" }, { "href": "https://api-shipx-pl.easypack24.net/v1/shipments/150", "id": 150, "status": "confirmed", "tracking_number": "633100159730624319900068" } ], "created_at": "2017-06-08T14:17:25.675+02:00", "updated_at": "2017-06-08T14:17:25.675+02:00" }
Informacje o błędach
Serwer może zwrócić następujące błędy
resource_not_found
- w przypadku gdy batch nie istniejetoken_invalid
- użytkownik nie ma praw dostępu do określonej organizacji