Search…
API Reference
Resources
Update a stock transfer
How to update an existing stock transfer via API
To update an existing stock transfer, send a PATCH request to the /api/stock_transfers/:id endpoint, where id is the ID of the resource that you want to update.
Here below the list of all the possible arguments that you can pass with the request body.

Request

PATCH https://yourdomain.commercelayer.io/api/stock_transfers/:id

Arguments

Body Parameter
Type
Required
type
string
Required
id
string
Required
attributes.sku_code
string
Optional
attributes._upcoming
boolean, value is 'true'
Optional
attributes._picking
boolean, value is 'true'
Optional
attributes._in_transit
boolean, value is 'true'
Optional
attributes._complete
boolean, value is 'true'
Optional
attributes._cancel
boolean, value is 'true'
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.sku
object
Optional
relationships.origin_stock_location
object
Optional
relationships.destination_stock_location
object
Optional

Example

Request
Response
The following request updates the stock transfer identified by the ID "xYZkjABcde":
1
curl -g -X PATCH \
2
'https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde' \
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": "stock_transfers",
9
"id": "xYZkjABcde",
10
"attributes": {
11
"sku_code": "TSHIRTMM000000FFFFFFXLXX"
12
}
13
}
14
}'
Copied!
On success, the API responds with a 200 OK status code, returning the updated resource object:
1
{
2
"data": {
3
"id": "xYZkjABcde",
4
"type": "stock_transfers",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde"
7
},
8
"attributes": {
9
"sku_code": "TSHIRTMM000000FFFFFFXLXX",
10
"status": "draft",
11
"quantity": 2,
12
"completed_at": "2018-01-01T12:00:00.000Z",
13
"cancelled_at": "2018-01-01T12:00:00.000Z",
14
"created_at": "2018-01-01T12:00:00.000Z",
15
"updated_at": "2018-01-01T12:00:00.000Z",
16
"reference": "ANY-EXTERNAL-REFEFERNCE",
17
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
18
"metadata": {
19
"foo": "bar"
20
}
21
},
22
"relationships": {
23
"sku": {
24
"links": {
25
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/relationships/sku",
26
"related": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/sku"
27
}
28
},
29
"origin_stock_location": {
30
"links": {
31
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/relationships/origin_stock_location",
32
"related": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/origin_stock_location"
33
}
34
},
35
"destination_stock_location": {
36
"links": {
37
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/relationships/destination_stock_location",
38
"related": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/destination_stock_location"
39
}
40
},
41
"shipment": {
42
"links": {
43
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/relationships/shipment",
44
"related": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/shipment"
45
}
46
},
47
"line_item": {
48
"links": {
49
"self": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/relationships/line_item",
50
"related": "https://yourdomain.commercelayer.io/api/stock_transfers/xYZkjABcde/line_item"
51
}
52
}
53
},
54
"meta": {
55
"mode": "test"
56
}
57
}
58
}
Copied!
Last modified 2mo ago
Copy link