Search…
API Reference
Resources
Create a delivery lead time
How to create a delivery lead time via API
To create a new delivery lead time, send a POST request to the /api/delivery_lead_times endpoint, passing the resource arguments in the request body.

Request

POST https://yourdomain.commercelayer.io/api/delivery_lead_times

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.min_hours
integer
Required
attributes.max_hours
integer
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.stock_location
object
Required
relationships.shipping_method
object
Required

Example

Request
Response
The following request creates a new delivery lead time:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/delivery_lead_times' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token' \
5
-H 'Content-Type: application/vnd.api+json' \
6
-d '{
7
"data": {
8
"type": "delivery_lead_times",
9
"attributes": {
10
"min_hours": 48,
11
"max_hours": 72
12
},
13
"relationships": {
14
"stock_location": {
15
"data": {
16
"type": "stock_locations",
17
"id": "QWERtyUpBa"
18
}
19
},
20
"shipping_method": {
21
"data": {
22
"type": "shipping_methods",
23
"id": "QWERtyUpBa"
24
}
25
}
26
}
27
}
28
}'
Copied!
On success, the API responds with a 201 Created status code, returning the created resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "delivery_lead_times",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde"
7
},
8
"attributes": {
9
"min_hours": 48,
10
"max_hours": 72,
11
"min_days": 2,
12
"max_days": 3,
13
"created_at": "2018-01-01T12:00:00.000Z",
14
"updated_at": "2018-01-01T12:00:00.000Z",
15
"reference": "ANY-EXTERNAL-REFEFERNCE",
16
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
17
"metadata": {
18
"foo": "bar"
19
}
20
},
21
"relationships": {
22
"stock_location": {
23
"links": {
24
"self": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/relationships/stock_location",
25
"related": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/stock_location"
26
}
27
},
28
"shipping_method": {
29
"links": {
30
"self": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/relationships/shipping_method",
31
"related": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/shipping_method"
32
}
33
},
34
"attachments": {
35
"links": {
36
"self": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/relationships/attachments",
37
"related": "https://yourdomain.commercelayer.io/api/delivery_lead_times/xYZkjABcde/attachments"
38
}
39
}
40
},
41
"meta": {
42
"mode": "test"
43
}
44
}
45
}
Copied!
Last modified 2mo ago
Copy link