[1.2.0] Szablony przesyłek
Zasób ShipmentTemplate
reprezentuje obiekt serializowanego szablonu przesyłki w kontekście organizacji, która go utworzyła.
Na tej stronie
Struktura
Zasób ShipmentTemplate
posiada następujące atrybuty:
| String | Nazwa szablonu | |
| String | Status |
|
| String | Opis szablonu | |
| JSON | zserializowany obekt przesylki | |
| DateTime | Ostatnia aktualizacja profilu użytkownika. | |
| DateTime | Data utworzenia profilu użytkownika. |
Przykład zasobu ShipmentTemplate
w formacie JSON:
1
2
3
4
5
6
7
8
9
10
11
{
"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
"id": 1,
"organization_id": "1",
"status": "activated",
"description": "description...",
"serialized_data": {...},
"organization": { ... },
"updated_at": "2015-09-29T15:22:00.000+02:00",
"created_at": "2015-09-29T15:22:00.000+02:00"
} |
Lista szablonów
Lista szablonów w ramach określonej organizacji:
1
GET /v1/organizations/:organization_id/shipment_templates |
Przykład zapytania
1
curl https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates -H "Authorization: Bearer ..." |
Odpowiedź
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
HTTP/1.1 200 OK
Content-Type: application/json
{
"href": "https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates",
"count": 15,
"per_page": 30,
"page": 1,
"items": [
{
"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
"id": 1, "organization_id": "1",
"status": "activated",
"description": "description...",
"serialized_data": {...},
"organization": { ... },
"updated_at": "2015-09-29T15:22:00.000+02:00",
"created_at": "2015-09-29T15:22:00.000+02:00"
}
]
} |
Informacje o błędach
Serwer może zwrócić następujący błąd:
resource_not_found
- w przypadku gdy szablon nie istnieje lub użytkownik nie ma praw dostępu do określonej organizacji.
Szczegóły szablonu
Pobieranie informacji o określonym szablonie, do którego użytkownik ma dostęp
1
GET /v1/shipment_templates/:id |
Przykład zapytania
1
curl -X GET https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H "Authorization: Bearer token" -H "Content-Type: application/json" |
Odpowiedź
1
2
3
4
5
6
7
8
9
10
11
12
13
HTTP/1.1 200 OK
Content-Type: application/json
{
"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
"id": 1,
"status": "activated",
"description": "(API Tests)",
"name": "Inittec Sp. z o.o. ",
"serialized_data": { ... },
"organization": { ... },
"created_at": "2016-03-22T09:31:28.609+01:00",
"updated_at": "2016-03-22T09:31:28.609+01:00"
} |
Informacje o błędach
Serwer może zwrócić następujący błąd:
resource_not_found
- w przypadku gdy szablon nie istnieje lub użytkownik nie ma praw dostępu do określonej organizacji.
Tworzenie szablonu
Tworzenie nowego szablonu
1
POST /v1/organizations/:organization_id/shipment_templates |
Parametry
| String | Nazwa szablonu | Atrybut jest wymagany.
|
| String | Status szablonu | Atrybut jest wymagany.
|
| String | Opis szablonu | Atrybut jest wymagany.
|
| Shipment | Zserializowany obiekt | Atrybut jest wymagany. |
Przykład zapytania
1
2
3
4
5
6
7
8
9
10
11
12
13
POST https://api-shipx-pl.easypack24.net/v1/organizations/1/shipment_templates
{
"name":"template name",
"status":"suspended",
"description":"description...",
"serialized_data": {
"receiver": {
"email": "paczkomat@test.pl",
"phone": "888000022"
},
"parcels": { "template": "small"}
}
} |
Odpowiedź
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
HTTP/1.1 200 OK
Content-Type: application/json
{
"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/6",
"id": 6,
"name": "non-active",
"status": "suspended",
"description": "description...",
"organization": {
...
},
"template": {
"status": "created",
"service": null,
"custom_attributes": {},
"cod": {
"amount": null,
"currency": null
},
"insurance": {
"amount": null,
"currency": null
},
"additional_services": [],
"reference": null,
"is_return": false,
"parcels": [
{
"id": null,
"template": "small",
"dimensions": {
"length": 380,
"width": 640,
"height": 80,
"unit": "mm"
},
"weight": {
"amount": 25,
"unit": "kg"
},
"tracking_number": null
}
],
"sender": null,
"receiver": {
"id": null,
"name": null,
"company_name": null,
"first_name": null,
"last_name": null,
"email": "paczkomat@test.pl",
"phone": "888000022",
"address": null
}
},
"created_at": "2016-10-04T12:43:37.454+02:00",
"updated_at": "2016-10-04T12:43:37.454+02:00"
} |
Informacje o błędach
validation_failed
- dane przesłane metodą POST są niepoprawne. Szczegóły zawarte w odpowiedzi w poludetails
,resource_not_found
- organizacja dla której użytkownik chce pobrać listę przesyłek, nie istnieje lub nie ma do niej dostępu.
Edytowanie szablonu
Tworzenie nowego szablonu
1
PUT /v1/shipment_templates/:id |
Parametry
| String | Nazwa szablonu | Atrybut nie jest wymagany.
|
| String | Status szablonu | Atrybut nie jest wymagany.
|
| String | Opis szablonu | Atrybut nie jest wymagany.
|
| Shipment | Zserializowany obiekt | Atrybut nie jest wymagany. |
Przykład zapytania
1
2
3
4
5
6
curl -X PUT https://api-shipx-pl.easypack24.net/v1/shipment_templates/1 -H "Authorization: Bearer token" -H "Content-Type: application/json" -d '{
"name":"szablon_1",
"status":"activated",
"description":"description...",
"serialized_data": { ... }
}' |
Odpowiedź
1
2
3
4
5
6
7
8
9
10
11
12
13
HTTP/1.1 200 OK
Content-Type: application/json
{
"href": "https://api-shipx-pl.easypack24.net/v1/shipment_templates/1",
"id": 1,
"status": "activated",
"description": "(API Tests)",
"name": "Inittec Sp. z o.o. ",
"serialized_data": { ... },
"organization": { ... },
"created_at": "2016-03-22T09:31:28.609+01:00",
"updated_at": "2016-03-22T09:31:28.609+01:00"
} |
Informacje o błędach
validation_failed
- dane przesłane metodą POST są niepoprawne. Szczegóły zawarte w odpowiedzi w poludetails
,resource_not_found
- szablon dla którego użytkownik chce pobrać listę przesyłek, nie istnieje lub nie ma do niej dostępu.