Search…
API Reference
Resources
List all inventory models
How to fetch a collection of inventory models via API
To fetch a collection of inventory models, send a GET request to the /api/inventory_models endpoint.

Request

GET https://yourdomain.commercelayer.io/api/inventory_models

Example

Request
Response
The following request fetches a collection of inventory models:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/inventory_models/' \
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 paginated collection of resource objects:
1
{
2
"data": [
3
{
4
"id": "xYZkjABcde",
5
"type": "inventory_models",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde"
8
},
9
"attributes": {
10
"name": "EU Inventory Model",
11
"strategy": "split_shipments",
12
"stock_locations_cutoff": 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
"inventory_stock_locations": {
23
"links": {
24
"self": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/relationships/inventory_stock_locations",
25
"related": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/inventory_stock_locations"
26
}
27
},
28
"inventory_return_locations": {
29
"links": {
30
"self": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/relationships/inventory_return_locations",
31
"related": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/inventory_return_locations"
32
}
33
},
34
"attachments": {
35
"links": {
36
"self": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/relationships/attachments",
37
"related": "https://yourdomain.commercelayer.io/api/inventory_models/xYZkjABcde/attachments"
38
}
39
}
40
},
41
"meta": {
42
"mode": "test"
43
}
44
},
45
{
46
"other": "... 9 inventory_models (first page)"
47
}
48
],
49
"meta": {
50
"record_count": 140,
51
"page_count": 14
52
},
53
"links": {
54
"first": "https://yourdomain.commercelayer.io/api/inventory_models?page[number]=1&page[size]=10",
55
"next": "https://yourdomain.commercelayer.io/api/inventory_models?page[number]=2&page[size]=10",
56
"last": "https://yourdomain.commercelayer.io/api/inventory_models?page[number]=14&page[size]=10"
57
}
58
}
Copied!

Sortable attributes

The list of inventory models can be sorted by the following attributes:
  • name
  • strategy
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 2mo ago