Powered By GitBook
Retrieve a shipment
How to fetch a specific shipment via API
To fetch a single shipment, send a GET request to the /api/shipments/:id endpoint, where id is the ID of the resource that you want to retrieve.

Request

GET https://yourdomain.commercelayer.io/api/shipments/:id

Example

Request
Response
The following request fetches the shipment identified by the id "xYZkjABcde":
1
curl -X GET \
2
https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a single resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "shipments",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde"
7
},
8
"attributes": {
9
"number": "#1234/S/001",
10
"status": "draft",
11
"currency_code": "EUR",
12
"cost_amount_cents": 1000,
13
"cost_amount_float": 10.0,
14
"formatted_cost_amount": "€10,00",
15
"skus_count": 2,
16
"selected_rate_id": "rate_f89e4663c3ed47ee94d37763f6d21d54",
17
"rates": [
18
{
19
"id": "rate_f89e4663c3ed47ee94d37763f6d21d54",
20
"rate": "45.59",
21
"carrier": "DHLExpress",
22
"service": "MedicalExpress"
23
}
24
],
25
"purchase_error_code": "SHIPMENT.POSTAGE.FAILURE",
26
"purchase_error_message": "Account not allowed for this service.",
27
"get_rates_started_at": "2018-01-01T12:00:00.000Z",
28
"get_rates_completed_at": "2018-01-01T12:00:00.000Z",
29
"purchase_started_at": "2018-01-01T12:00:00.000Z",
30
"purchase_completed_at": "2018-01-01T12:00:00.000Z",
31
"purchase_failed_at": "2018-01-01T12:00:00.000Z",
32
"created_at": "2018-01-01T12:00:00.000Z",
33
"updated_at": "2018-01-01T12:00:00.000Z",
34
"reference": "ANY-EXTERNAL-REFEFERNCE",
35
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
36
"metadata": {
37
"foo": "bar"
38
}
39
},
40
"relationships": {
41
"order": {
42
"links": {
43
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/order",
44
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/order"
45
}
46
},
47
"shipping_category": {
48
"links": {
49
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_category",
50
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_category"
51
}
52
},
53
"stock_location": {
54
"links": {
55
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_location",
56
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_location"
57
}
58
},
59
"origin_address": {
60
"links": {
61
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/origin_address",
62
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/origin_address"
63
}
64
},
65
"shipping_address": {
66
"links": {
67
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_address",
68
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_address"
69
}
70
},
71
"shipping_method": {
72
"links": {
73
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipping_method",
74
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipping_method"
75
}
76
},
77
"delivery_lead_time": {
78
"links": {
79
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/delivery_lead_time",
80
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/delivery_lead_time"
81
}
82
},
83
"shipment_line_items": {
84
"links": {
85
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/shipment_line_items",
86
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/shipment_line_items"
87
}
88
},
89
"stock_line_items": {
90
"links": {
91
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_line_items",
92
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_line_items"
93
}
94
},
95
"stock_transfers": {
96
"links": {
97
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/stock_transfers",
98
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/stock_transfers"
99
}
100
},
101
"available_shipping_methods": {
102
"links": {
103
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/available_shipping_methods",
104
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/available_shipping_methods"
105
}
106
},
107
"carrier_accounts": {
108
"links": {
109
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/carrier_accounts",
110
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/carrier_accounts"
111
}
112
},
113
"parcels": {
114
"links": {
115
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/parcels",
116
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/parcels"
117
}
118
},
119
"attachments": {
120
"links": {
121
"self": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/relationships/attachments",
122
"related": "https://yourdomain.commercelayer.io/api/shipments/xYZkjABcde/attachments"
123
}
124
}
125
},
126
"meta": {
127
"mode": "test"
128
}
129
}
130
}
Copied!
Last modified 25d ago
Copy link