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

Request

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

Example

Request
Response
The following request fetches a collection of imports:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/imports/' \
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": "imports",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/imports/xYZkjABcde"
8
},
9
"attributes": {
10
"resource_type": "skus",
11
"parent_resource_id": "1234",
12
"status": "in_progress",
13
"started_at": "2018-01-01T12:00:00.000Z",
14
"completed_at": "2018-01-01T12:00:00.000Z",
15
"interrupted_at": "2018-01-01T12:00:00.000Z",
16
"inputs": [
17
{
18
"code": "ABC",
19
"name": "Foo"
20
},
21
{
22
"code": "DEF",
23
"name": "Bar"
24
}
25
],
26
"inputs_size": 300,
27
"errors_count": 30,
28
"warnings_count": 1,
29
"destroyed_count": 99,
30
"processed_count": 270,
31
"errors_log": {
32
"ABC": {
33
"name": [
34
"has already been taken"
35
]
36
}
37
},
38
"warnings_log": {
39
"ABC": [
40
"could not be deleted"
41
]
42
},
43
"cleanup_records": true,
44
"created_at": "2018-01-01T12:00:00.000Z",
45
"updated_at": "2018-01-01T12:00:00.000Z",
46
"reference": "ANY-EXTERNAL-REFEFERNCE",
47
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
48
"metadata": {
49
"foo": "bar"
50
}
51
},
52
"relationships": {
53
"events": {
54
"links": {
55
"self": "https://yourdomain.commercelayer.io/api/imports/xYZkjABcde/relationships/events",
56
"related": "https://yourdomain.commercelayer.io/api/imports/xYZkjABcde/events"
57
}
58
}
59
},
60
"meta": {
61
"mode": "test"
62
}
63
},
64
{
65
"other": "... 9 imports (first page)"
66
}
67
],
68
"meta": {
69
"record_count": 140,
70
"page_count": 14
71
},
72
"links": {
73
"first": "https://yourdomain.commercelayer.io/api/imports?page[number]=1&page[size]=10",
74
"next": "https://yourdomain.commercelayer.io/api/imports?page[number]=2&page[size]=10",
75
"last": "https://yourdomain.commercelayer.io/api/imports?page[number]=14&page[size]=10"
76
}
77
}
Copied!
Remember that when you fetch a list of resources you get paginated result.

Sortable attributes

The list of imports can be sorted by the following attributes:
  • resource_type
  • parent_resource_id
  • status
  • started_at
  • completed_at
  • interrupted_at
  • inputs_size
  • errors_count
  • warnings_count
  • destroyed_count
  • processed_count
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin