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

Request

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

Example

Request
Response
The following request fetches a collection of returns:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/returns/' \
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": "returns",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde"
8
},
9
"attributes": {
10
"number": "#1234/R/001",
11
"status": "draft",
12
"customer_email": "[email protected]",
13
"skus_count": 2,
14
"approved_at": "2018-01-01T12:00:00.000Z",
15
"cancelled_at": "2018-01-01T12:00:00.000Z",
16
"shipped_at": "2018-01-01T12:00:00.000Z",
17
"rejected_at": "2018-01-01T12:00:00.000Z",
18
"received_at": "2018-01-01T12:00:00.000Z",
19
"archived_at": "2018-01-01T12:00:00.000Z",
20
"created_at": "2018-01-01T12:00:00.000Z",
21
"updated_at": "2018-01-01T12:00:00.000Z",
22
"reference": "ANY-EXTERNAL-REFEFERNCE",
23
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
24
"metadata": {
25
"foo": "bar"
26
}
27
},
28
"relationships": {
29
"order": {
30
"links": {
31
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/order",
32
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/order"
33
}
34
},
35
"customer": {
36
"links": {
37
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/customer",
38
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/customer"
39
}
40
},
41
"stock_location": {
42
"links": {
43
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/stock_location",
44
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/stock_location"
45
}
46
},
47
"origin_address": {
48
"links": {
49
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/origin_address",
50
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/origin_address"
51
}
52
},
53
"destination_address": {
54
"links": {
55
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/destination_address",
56
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/destination_address"
57
}
58
},
59
"return_line_items": {
60
"links": {
61
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/return_line_items",
62
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/return_line_items"
63
}
64
},
65
"attachments": {
66
"links": {
67
"self": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/relationships/attachments",
68
"related": "https://yourdomain.commercelayer.io/api/returns/xYZkjABcde/attachments"
69
}
70
}
71
},
72
"meta": {
73
"mode": "test"
74
}
75
},
76
{
77
"other": "... 9 returns (first page)"
78
}
79
],
80
"meta": {
81
"record_count": 140,
82
"page_count": 14
83
},
84
"links": {
85
"first": "https://yourdomain.commercelayer.io/api/returns?page[number]=1&page[size]=10",
86
"next": "https://yourdomain.commercelayer.io/api/returns?page[number]=2&page[size]=10",
87
"last": "https://yourdomain.commercelayer.io/api/returns?page[number]=14&page[size]=10"
88
}
89
}
Copied!

Sortable attributes

The list of returns can be sorted by the following attributes:
  • status
  • approved_at
  • cancelled_at
  • shipped_at
  • rejected_at
  • received_at
  • archived_at
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 20d ago