Create an export
How to create an export via API
To create a new export, send a
POST
request to the /api/exports
endpoint, passing the resource arguments in the request body.POST https://yourdomain.commercelayer.io/api/exports
Body Parameter | Type | Required |
---|---|---|
type | string | Required |
attributes.resource_type | string | Required |
attributes.format | string | Optional |
attributes.includes | array | Optional |
attributes.filters | object | Optional |
attributes.dry_data | boolean | Optional |
attributes.reference | string | Optional |
attributes.reference_origin | string | Optional |
attributes.metadata | object | Optional |
Request
Response
The following request creates a new export:
curl -g -X POST \
'https://yourdomain.commercelayer.io/api/exports' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: Bearer your-access-token' \
-H 'Content-Type: application/vnd.api+json' \
-d '{
"data": {
"type": "exports",
"attributes": {
"resource_type": "skus"
}
}
}'
On success, the API responds with a
201 Created
status code, returning the created resource object:{
"data": {
"id": "xYZkjABcde",
"type": "exports",
"links": {
"self": "https://yourdomain.commercelayer.io/api/exports/xYZkjABcde"
},
"attributes": {
"resource_type": "skus",
"format": "json",
"status": "in_progress",
"includes": [
"prices.price_tiers"
],
"filters": {
"code_eq": "AAA"
},
"dry_data": false,
"started_at": "2018-01-01T12:00:00.000Z",
"completed_at": "2018-01-01T12:00:00.000Z",
"interrupted_at": "2018-01-01T12:00:00.000Z",
"records_count": 300,
"attachment_url": "http://cl_exports.s3.amazonaws.com/",
"created_at": "2018-01-01T12:00:00.000Z",
"updated_at": "2018-01-01T12:00:00.000Z",
"reference": "ANY-EXTERNAL-REFEFERNCE",
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
"metadata": {
"foo": "bar"
}
},
"relationships": {
"events": {
"links": {
"self": "https://yourdomain.commercelayer.io/api/exports/xYZkjABcde/relationships/events",
"related": "https://yourdomain.commercelayer.io/api/exports/xYZkjABcde/events"
}
}
},
"meta": {
"mode": "test"
}
}
}
Last modified 1yr ago