BETA

Importing Products

This page documents the API under the product endpoint /{projectKey}/products. Namely, we document ProductImportRequest and the endpoint methods for ImportOperations for Products.

ProductImportRequest

Representations

ProductImportRequest

An import request for multiple product import resources.

type
String
"product"

The product import resource type.

resources
Array of ProductImport

The product import resources of this request.

MaxItems: 20
Example: json
{
"type" : "product",
"resources" : [ {
"typeId" : "product",
"key" : "t-shirt",
"name" : {
"en" : "t-shirt"
},
"productType" : {
"typeId" : "product-type",
"key" : "sample"
},
"slug" : {
"en" : "t-shirt-slug"
},
"metaTitle" : {
"en" : "title"
},
"metaDescription" : {
"en" : "description"
},
"metaKeywords" : {
"en" : "Keywords"
}
} ]
}

ProductImport

Import representation for a prduct.

The import representation for a product is the most minimal representation required for creating a product in commercetools.

key
String
name
LocalizedString

Maps to Product.name.

The product's product type. Maps to Product.productType.

The product type referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

slug
LocalizedString

Human-readable identifiers usually used as deep-link URL to the related product. Each slug must be unique across a project, but a product can have the same slug for different languages. Allowed are alphabetic, numeric, underscore (_) and hyphen (-) characters.

description
LocalizedString

Maps to Product.description.

categories

An array of references to a categories by their keys. Maps to Product.categories.

The categories referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

metaTitle
LocalizedString
metaDescription
LocalizedString
metaKeywords
LocalizedString

References a tax category by its key.

The tax category referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

searchKeywords
SearchKeywords

References a state by its key.

The tax category referenced must already exist in the commercetools project, or the import operation state is set to Unresolved.

publish
Boolean

If there were updates, only the updates will be published to staged and current projection.

Default: false

Endpoints

Request new Product Data to be Imported

Creates import request for creating new products or updating existing ones.

POST
https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Response:

201ImportResponse

Request Products to be Deleted

Deletes the product given by the resource key.

DELETE
https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/resourceKey={resourceKey}
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
resourceKey
String
-
Response:

200ImportOperationStatus

Request Example:cURL
curl -X DELETE https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/resourceKey={resourceKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get ImportOperations

Get ImportOperations by an ImportSink Key

Retrieves all product import operations of an import sink key.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/import-operations
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}, view_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
Query Parameters:
limit
Float
-
offset
Float
-
resourceKey
String
The key of the import operation to retrieve.
state
The state of the import operations to retrieve.
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/import-operations -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get an ImportOperation by its ID

Retrieves the import operation with the given id.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/import-operations/{id}
OAuth 2.0 Scopes:
manage_project:{projectKey}, manage_products:{projectKey}, view_products:{projectKey}
Path Parameters:
projectKey
String
The commercetools project key.
importSinkKey
String
The import sink used to create the new resource
id
String
The operation identifier
Response:
Request Example:cURL
curl -X GET https://import.europe-west1.gcp.commercetools.com/{projectKey}/products/importSinkKey={importSinkKey}/import-operations/{id} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'
Response Example:json
{
"version" : 1,
"state" : "Unresolved",
"importSinkKey" : "category-import-sink",
"resourceKey" : "child-category",
"resourceType" : "category",
"resourceAsString" : "'{}'",
"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",
"retryCount" : 0,
"unresolvedReferences" : [ {
"typeId" : "category",
"key" : "my-parent-category-key"
} ]
}