BETA

Importing Product Types

This page documents the API under the product type endpoint /{projectKey}/product-types. Namely, we document ProductTypeImportRequest and the endpoint methods for ImportOperations for Product Types.

ProductTypeImportRequest

Representations

ProductTypeImportRequest

An import request for multiple product type import resources.

type
String
"product-type"

The product type import resource type.

resources

The product type import resources of this request.

MaxItems: 20
Example: json
{
"type" : "product-type",
"resources" : [ {
"key" : "sample",
"name" : "test_product_type",
"description" : "Test product type.",
"attributes" : [ {
"name" : "product-ref-attribute",
"label" : {
"en" : "selling product"
},
"isRequired" : false,
"isSearchable" : false,
"type" : {
"name" : "reference",
"referenceTypeId" : "category"
}
} ]
} ]
}

ProductTypeImport

Import representation for a product type.

key
String
name
String

Maps to ProductType.name.

description
String

Maps to ProductType.description.

attributes
Array of AttributeDefinition

The product type's attributes.

Endpoints

Request Product Type Data to be Imported

Creates import request for creating new product types or updating existing ones.

POST
https://import.europe-west1.gcp.commercetools.com/{projectKey}/product-types/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 Product Types to be Deleted

Deletes the product type given by the resource key.

DELETE
https://import.europe-west1.gcp.commercetools.com/{projectKey}/product-types/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}/product-types/importSinkKey={importSinkKey}/resourceKey={resourceKey} -i \
--header 'Authorization: Bearer ${BEARER_TOKEN}'

Get ImportOperations

Get ImportOperations by an ImportSink Key

Retrieves all import operations of an import sink key.

GET
https://import.europe-west1.gcp.commercetools.com/{projectKey}/product-types/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}/product-types/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}/product-types/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}/product-types/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"
} ]
}