Create an import

How to create an import via API

To create a new import, send a POST request to the /api/imports endpoint, passing the resource arguments in the request body.

Request

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

Arguments

Body ParameterTypeRequired

type

string

Required

attributes.resource_type

string

Required

attributes.format

string

Optional

attributes.parent_resource_id

string

Optional

attributes.inputs

array

Required

attributes.reference

string

Optional

attributes.reference_origin

string

Optional

attributes.metadata

object

Optional

Example

The following request creates a new import:

curl -g -X POST \
  'https://yourdomain.commercelayer.io/api/imports' \
  -H 'Accept: application/vnd.api+json' \
  -H 'Authorization: Bearer your-access-token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
  "data": {
    "type": "imports",
    "attributes": {
      "resource_type": "skus",
      "inputs": [
        {
          "code": "ABC",
          "name": "Foo"
        },
        {
          "code": "DEF",
          "name": "Bar"
        }
      ]
    }
  }
}'

Last updated