Search…
API Reference
Resources
Update a return
How to update an existing return via API
To update an existing return, send a PATCH request to the /api/returns/: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/returns/:id

Arguments

Body Parameter
Type
Required
type
string
Required
id
string
Required
attributes._request
boolean, value is 'true'
Optional
attributes._approve
boolean, value is 'true'
Optional
attributes._cancel
boolean, value is 'true'
Optional
attributes._ship
boolean, value is 'true'
Optional
attributes._reject
boolean, value is 'true'
Optional
attributes._receive
boolean, value is 'true'
Optional
attributes._restock
boolean, value is 'true'
Optional
attributes._archive
boolean, value is 'true'
Optional
attributes._unarchive
boolean, value is 'true'
Optional
attributes.reference
string
Optional
attributes.reference_origin
string
Optional
attributes.metadata
object
Optional
relationships.stock_location
object
Optional

Example

Request
Response
The following request updates the return identified by the ID "xYZkjABcde":
1
curl -g -X PATCH \
2
'https://yourdomain.commercelayer.io/api/returns/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": "returns",
9
"id": "xYZkjABcde",
10
"attributes": {
11
"_request": true
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": "returns",
5
"links": {
6
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde"
7
},
8
"attributes": {
9
"number": "#1234/R/001",
10
"status": "draft",
11
"customer_email": "[email protected]",
12
"skus_count": 2,
13
"approved_at": "2018-01-01T12:00:00.000Z",
14
"cancelled_at": "2018-01-01T12:00:00.000Z",
15
"shipped_at": "2018-01-01T12:00:00.000Z",
16
"rejected_at": "2018-01-01T12:00:00.000Z",
17
"received_at": "2018-01-01T12:00:00.000Z",
18
"archived_at": "2018-01-01T12:00:00.000Z",
19
"created_at": "2018-01-01T12:00:00.000Z",
20
"updated_at": "2018-01-01T12:00:00.000Z",
21
"reference": "ANY-EXTERNAL-REFEFERNCE",
22
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
23
"metadata": {
24
"foo": "bar"
25
}
26
},
27
"relationships": {
28
"order": {
29
"links": {
30
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/order",
31
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/order"
32
}
33
},
34
"customer": {
35
"links": {
36
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/customer",
37
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/customer"
38
}
39
},
40
"stock_location": {
41
"links": {
42
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/stock_location",
43
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/stock_location"
44
}
45
},
46
"origin_address": {
47
"links": {
48
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/origin_address",
49
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/origin_address"
50
}
51
},
52
"destination_address": {
53
"links": {
54
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/destination_address",
55
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/destination_address"
56
}
57
},
58
"return_line_items": {
59
"links": {
60
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/return_line_items",
61
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/return_line_items"
62
}
63
},
64
"attachments": {
65
"links": {
66
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/attachments",
67
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/attachments"
68
}
69
}
70
},
71
"meta": {
72
"mode": "test"
73
}
74
}
75
}
Copied!
Last modified 20d ago
Copy link