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

Request

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

Example

Request
Response
The following request fetches a collection of markets:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/markets/' \
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": "markets",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde"
8
},
9
"attributes": {
10
"number": 1234,
11
"name": "EU Market",
12
"facebook_pixel_id": "1234567890",
13
"checkout_url": "https://checkout.yourbrand.com/:order_id",
14
"external_prices_url": "https://external_prices.yourbrand.com",
15
"private": true,
16
"created_at": "2018-01-01T12:00:00.000Z",
17
"updated_at": "2018-01-01T12:00:00.000Z",
18
"reference": "ANY-EXTERNAL-REFEFERNCE",
19
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
20
"metadata": {
21
"foo": "bar"
22
}
23
},
24
"relationships": {
25
"merchant": {
26
"links": {
27
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/merchant",
28
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/merchant"
29
}
30
},
31
"price_list": {
32
"links": {
33
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/price_list",
34
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/price_list"
35
}
36
},
37
"inventory_model": {
38
"links": {
39
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/inventory_model",
40
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/inventory_model"
41
}
42
},
43
"tax_calculator": {
44
"links": {
45
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/tax_calculator",
46
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/tax_calculator"
47
}
48
},
49
"customer_group": {
50
"links": {
51
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/customer_group",
52
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/customer_group"
53
}
54
},
55
"attachments": {
56
"links": {
57
"self": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/relationships/attachments",
58
"related": "https://yourdomain.commercelayer.io/api/markets/xYZkjABcde/attachments"
59
}
60
}
61
},
62
"meta": {
63
"mode": "test"
64
}
65
},
66
{
67
"other": "... 9 markets (first page)"
68
}
69
],
70
"meta": {
71
"record_count": 140,
72
"page_count": 14
73
},
74
"links": {
75
"first": "https://yourdomain.commercelayer.io/api/markets?page[number]=1&page[size]=10",
76
"next": "https://yourdomain.commercelayer.io/api/markets?page[number]=2&page[size]=10",
77
"last": "https://yourdomain.commercelayer.io/api/markets?page[number]=14&page[size]=10"
78
}
79
}
Copied!

Sortable attributes

The list of markets can be sorted by the following attributes:
  • name
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 23d ago