This is the early access documentation preview for Custom Views. This documentation might not be in sync with our official documentation.

Import Operations

Get the import status of an individual resource.

Import Operations can be retrieved by id or be queried within a specific Import Container.

Both Import Operations and Import Summary can be used to monitor the progress of imports. Import Operations focus on the status of each import resource, and Import Summaries report the status of an Import Container by the number of resources in each Processing State.

Import Operations are automatically deleted 48 hours after they are created.

To achieve the best performance with the Import API, we recommend to use fewer than 200000 Import Operations per Import Container.

Representations

ImportOperation

An Import Operation is automatically deleted in 48 hours after it is created.

Import Operation describes the import status of a specific resource.

id
String

The ID of the ImportOperation.

version
Int

The version of the ImportOperation.

importContainerKey
String

The key of the importContainer.

resourceKey
String

The key of the resource.

state

The import status of the resource. Set to rejected or validationFailed if the import of the resource was not successful.

resourceVersion
Int

The version of the imported resource when the import was successful.

errors
Array of ErrorObject

Contains an error if the import of the resource was not successful. See Errors.

unresolvedReferences
Array of UnresolvedReferences

In case of unresolved status this array will show the unresolved references

expiresAt

The expiration time of the ImportOperation.

createdAt

The time when the ImportOperation was created.

lastModifiedAt

The last time When the ImportOperation was modified.

Example: unresolvedjson
{
"version": 1,
"state": "unresolved",
"importContainerKey": "category-import-container",
"resourceKey": "child-category",
"resourceType": "category",
"id": "252c6ed3-c668-4610-afe9-87b9255e62e0",
"createdAt": "2018-02-05T09:47:16.648Z",
"lastModifiedAt": "2018-02-05T09:47:16.649Z",
"expiresAt": "2018-02-08T09:47:16.649Z"
}
Example: validationFailedjson
{
"version": 3,
"state": "validationFailed",
"errors": [
{
"code": "RequiredField",
"message": "The required field 'key' is missing.",
"field": "key"
}
],
"importContainerKey": "category-import-container",
"id": "252c6ed3-c668-4610-afe9-87b9255e62e0",
"resourceKey": "root-category",
"resourceType": "category",
"createdAt": "2018-02-05T09:47:16.648Z",
"lastModifiedAt": "2018-02-05T09:47:16.649Z",
"expiresAt": "2018-02-08T09:47:16.649Z"
}

ImportOperationPagedResponse

PagedQueryResult for Import Operations.

limit
Int
offset
Int

Number of elements skipped.

count
Int

The actual number of results returned.

total
Int

The total number of import operations matching the query.

results
Array of ImportOperation

The array of Import Operations matching the query.

ImportResponse

A list of the ID's and validation statuses of newly created ImportOperations. Used as a response at each resource-specific import endpoint, for example, at Import Categories and Import ProductTypes.

operationStatus
MaxItems: 20

ImportOperationStatus

operationId
String

The ID of the ImportOperation.

The validation state of the ImportOperation.

errors
Array of ErrorObject

The validation errors for the ImportOperation. See Errors.

ImportOperationState

Describes the validation state of a newly created ImportOperation.

processing

This is an initial state of import resource and is currently processing.

validationFailed

The validation of the import resource failed.

Get ImportOperation

GET
https://import.{region}.commercetools.com/{projectKey}/import-operations/{id}

Retrieves the ImportOperation of a given ID.

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 Project key.

id
String

The operation identifier

Response:
200ImportOperationasapplication/json
Request Example:cURL
curl --get https://import.{region}.commercetools.com/{projectKey}/import-operations/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: ImportOperationjson
{
"version": 1,
"state": "unresolved",
"importContainerKey": "category-import-container",
"resourceKey": "child-category",
"resourceType": "category",
"id": "252c6ed3-c668-4610-afe9-87b9255e62e0",
"createdAt": "2018-02-05T09:47:16.648Z",
"lastModifiedAt": "2018-02-05T09:47:16.649Z",
"expiresAt": "2018-02-08T09:47:16.649Z"
}

Query ImportOperations

GET
https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}/import-operations

Retrieves all ImportOperations of a given ImportContainer key.

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 Project key.

importContainerKey
String

The key of the import container.

Query parameters:
sort
String

See Sorting.

The parameter can be passed multiple times.
resourceKey
String

The key of the ImportOperation to retrieve.

state

The state of the ImportOperations to retrieve.

debug
Boolean

In case of Unresolved, it will show the unresolved references.

limit
Int
offset
Int

Number of elements skipped.

Response:
200ImportOperationPagedResponseasapplication/json
Request Example:cURL
curl --get https://import.{region}.commercetools.com/{projectKey}/import-containers/{importContainerKey}/import-operations -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
200 Response Example: ImportOperationPagedResponsejson
{
"limit": 100,
"offset": 0,
"count": 1,
"total": 1,
"results": [
{
"version": 3,
"state": "validationFailed",
"errors": [
{
"code": "RequiredField",
"message": "The required field 'key' is missing.",
"field": "key"
}
],
"importContainerKey": "category-import-container",
"resourceKey": "root-category",
"resourceType": "category",
"id": "252c6ed3-c668-4610-afe9-87b9255e62e0",
"createdAt": "2018-02-05T09:47:16.648Z",
"lastModifiedAt": "2018-02-05T09:47:16.649Z",
"expiresAt": "2018-02-08T09:47:16.649Z"
}
]
}