API reference
List all merchants
How to fetch a collection of merchants via API
To fetch a collection of merchants, send a GET request to the /api/merchants endpoint.

Request

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

Example

Request
Response
The following request fetches a collection of merchants:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/merchants/' \
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": "merchants",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/merchants/xYZkjABcde"
8
},
9
"attributes": {
10
"name": "The Brand Inc.",
11
"created_at": "2018-01-01T12:00:00.000Z",
12
"updated_at": "2018-01-01T12:00:00.000Z",
13
"reference": "ANY-EXTERNAL-REFEFERNCE",
14
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
15
"metadata": {
16
"foo": "bar"
17
}
18
},
19
"relationships": {
20
"address": {
21
"links": {
22
"self": "https://yourdomain.commercelayer.io/api/merchants/xYZkjABcde/relationships/address",
23
"related": "https://yourdomain.commercelayer.io/api/merchants/xYZkjABcde/address"
24
}
25
},
26
"attachments": {
27
"links": {
28
"self": "https://yourdomain.commercelayer.io/api/merchants/xYZkjABcde/relationships/attachments",
29
"related": "https://yourdomain.commercelayer.io/api/merchants/xYZkjABcde/attachments"
30
}
31
}
32
},
33
"meta": {
34
"mode": "test"
35
}
36
},
37
{
38
"other": "... 9 merchants (first page)"
39
}
40
],
41
"meta": {
42
"record_count": 140,
43
"page_count": 14
44
},
45
"links": {
46
"first": "https://yourdomain.commercelayer.io/api/merchants?page[number]=1&page[size]=10",
47
"next": "https://yourdomain.commercelayer.io/api/merchants?page[number]=2&page[size]=10",
48
"last": "https://yourdomain.commercelayer.io/api/merchants?page[number]=14&page[size]=10"
49
}
50
}
Copied!
Remember that when you fetch a list of resources you get paginated result.

Sortable attributes

The list of merchants can be sorted by the following attributes:
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin