Search…
API Reference
Resources
Create an inventory return location
How to create an inventory return location via API
To create a new inventory return location, send a POST request to the /api/inventory_return_locations endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body Parameter
Type
Required
type
string
Required
attributes.priority
integer
Required
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.stock_location
object
Required
relationships.inventory_model
object
Required

Example

Request
Response
The following request creates a new inventory return location:
1
curl -g -X POST \
2
'https://yourdomain.commercelayer.io/api/inventory_return_locations' \
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": "inventory_return_locations",
9
"attributes": {
10
"priority": 1
11
},
12
"relationships": {
13
"stock_location": {
14
"data": {
15
"type": "stock_locations",
16
"id": "QWERtyUpBa"
17
}
18
},
19
"inventory_model": {
20
"data": {
21
"type": "inventory_models",
22
"id": "QWERtyUpBa"
23
}
24
}
25
}
26
}
27
}'
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": "inventory_return_locations",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/inventory_return_locations/xYZkjABcde"
7
},
8
"attributes": {
9
"priority": 1,
10
"created_at": "2018-01-01T12:00:00.000Z",
11
"updated_at": "2018-01-01T12:00:00.000Z",
12
"reference": "ANY-EXTERNAL-REFEFERNCE",
13
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
14
"metadata": {
15
"foo": "bar"
16
}
17
},
18
"relationships": {
19
"stock_location": {
20
"links": {
21
"self": "https://yourdomain.commercelayer.io/api/inventory_return_locations/xYZkjABcde/relationships/stock_location",
22
"related": "https://yourdomain.commercelayer.io/api/inventory_return_locations/xYZkjABcde/stock_location"
23
}
24
},
25
"inventory_model": {
26
"links": {
27
"self": "https://yourdomain.commercelayer.io/api/inventory_return_locations/xYZkjABcde/relationships/inventory_model",
28
"related": "https://yourdomain.commercelayer.io/api/inventory_return_locations/xYZkjABcde/inventory_model"
29
}
30
}
31
},
32
"meta": {
33
"mode": "test"
34
}
35
}
36
}
Copied!
Last modified 23d ago
Copy link