Import Containers

An Import Container is the entry point of the Import API requests and serves as a data container for asynchronous API calls. Every create, update, or patch request sent to the Import API is first accumulated in an Import Container and then asynchronously imported into the platform.

Import Containers can be used to organize import requests. For example, if you import data from multiple sources, you can create an Import Container for each source. This enables you to monitor the progress of import by the source by passing Import Containers as a path parameter.

When you perform full data imports, it may be useful to create a new Import Container every time to distinguish imports performed on different occasions. On the other hand, it is also a good idea to use a single permanent Import Container for routine data import that does not require a specific attention.

Representations

ImportContainer

Serves as the entry point of resources. An Import Container is not resource type-specific.

version
Int

The version of the ImportContainer.

key
String

User-defined unique identifier for the ImportContainer. Keys can only contain alphanumeric characters (a-Z, 0-9), underscores and hyphens (_, -).

createdAt

The time when the ImportContainer was created.

lastModifiedAt

The last time when the ImportContainer was modified.

resourceType

The resource type the ImportContainer is able to handle. If not present, the ImportContainer is able to import all of the supported ImportResourceTypes.

Example: minimaljson
{
"key" : "my-import-container",
"version" : 1,
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z"
}

ImportContainerDraft

The representation sent to the server when creating an ImportContainer.

key
String

User-defined unique identifier of the ImportContainer. Keys can only contain alphanumeric characters (a-Z, 0-9), underscores and hyphens (_, -).

resourceType

The resource type to be imported. If not given, the ImportContainer is able to import all of the supported ImportResourceTypes.

Example: minimaljson
{
"key" : "my-import-container"
}

ImportContainerUpdateDraft

The representation sent to the server when updating an import container.

version
Int

Current version of the ImportContainer.

resourceType

The resource type to be imported. If not given, the ImportContainer is able to import all of the supported ImportResourceTypes.

Example: minimaljson
{
"version" : 1,
"resourceType" : "product"
}

ImportResourceType

The resource types supported by the Import API.

  • category
  • price
  • product
  • product-draft
  • product-type
  • product-variant
  • product-variant-patch
  • order
  • order-patch
  • customer

ImportContainerPagedResponse

PagedQueryResult for ImportContainers. Used as a response to a query request for ImportContainers.

limit
Int

The number of results requested in the query request.

offset
Int

The number of elements skipped, not a page number. Supplied by the client or the server default.

count
Int

The actual number of results returned.

total
Int

The total number of results matching the query.

results
Array of ImportContainer

The array of Import Containers matching the query.

Get ImportContainer

Retrieves the import container given by the key.

GET
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}, view_import_containers:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

importContainerKey
String

The key of the import container.

Response:
Request Example:cURL
curl -X GET https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Response Example:json
{
"key" : "my-import-container",
"version" : 1,
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z"
}

Query ImportContainers

Retrieves all import containers of a given project key.

GET
https://import.{region}.commercetools.com/{projectKey}/import-containers
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}, view_import_containers:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

Query parameters:
sort
String

See Sorting.

The parameter can be passed multiple times.
limit
Float
offset
Float
Request Example:cURL
curl -X GET https://import.{region}.commercetools.com/{projectKey}/import-containers -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Create ImportContainer

Creates a new import container.

POST
https://import.{region}.commercetools.com/{projectKey}/import-containers
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

Response:
Response Example:json
{
"key" : "my-import-container",
"version" : 1,
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z"
}

Update ImportContainer

Updates the import container given by the key.

PUT
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

importContainerKey
String

The key of the import container.

Response:
Response Example:json
{
"key" : "my-import-container",
"version" : 1,
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z"
}

Delete ImportContainer

Deletes the import container given by the key.

DELETE
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}
OAuth 2.0 Scopes:
manage_import_containers:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

importContainerKey
String

The key of the import container.

Response:
Request Example:cURL
curl -X DELETE https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Response Example:json
{
"key" : "my-import-container",
"version" : 1,
"createdAt" : "2018-02-05T09:47:16.648Z",
"lastModifiedAt" : "2018-02-05T09:47:16.649Z"
}