Importing Categories
This endpoint can be used to import Category data to create and update Categories in a commercetools Project. The Category data to import is represented by CategoryImport and loaded in a CategoryImportRequest, which is posted to import Categories.
To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.
Representations
CategoryImportRequest
The request body to import Categories. Contains data for Categories to be created or updated in a commercetools Project.
type String | "category" The category import resource type. |
resources Array of CategoryImport | The category import resources of this request. MaxItems:20 |
{"type" : "category","resources" : [ {"key" : "greatTestCat","name" : {"en" : "greatTestCat"},"slug" : {"en" : "great-slug"},"description" : {"de" : "Beschreibung der Kategorie","en" : "category's description"},"parent" : {"typeId" : "category","key" : "category-key"},"orderHint" : "category's order hint","externalId" : "external-id","metaTitle" : {"de" : "der Metatitel der Katze","en" : "the cat's meta title"},"metaDescription" : {"de" : "die Meta-Beschreibung der Katze","en" : "the cat's meta description"},"metaKeywords" : {"de" : "die Schlüsselwörter der Katze","en" : "the cat's key words"},"assets" : [ {"key" : "asset-key","sources" : [ {"uri" : "https://google.com","key" : "asset-source-key","dimensions" : {"w" : 12,"h" : 10},"contentType" : "dummy content type"} ],"name" : {"de" : "Asset-Name","en" : "asset name"},"description" : {"de" : "Asset-Beschreibung","en" : "asset description"},"tags" : [ "tag 1" ],"custom" : {"type" : {"key" : "custom-type","typeId" : "type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : false}}}} ],"custom" : {"type" : {"typeId" : "type","key" : "custom-type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : true},"string-field" : {"type" : "String","value" : "a string"}}}} ]}
CategoryImport
The data representation for a Category to be imported that is persisted as a Category in the Project.
key String | |
name | Maps to |
slug | Maps to |
description | Maps to |
parent | Maps to |
orderHint String | Maps to |
externalId String | Maps to |
metaTitle | Maps to |
metaDescription | Maps to |
metaKeywords | Maps to |
assets Array of Asset | |
custom | The custom fields for this Category. |
Import Categories
Creates a request for creating new Categories or updating existing ones.
manage_products:{projectKey}
region String | The Region in which the Project is hosted. |
projectKey String | The commercetools Project key. |
importContainerKey String | The ImportContainer used to create the new resource |
curl -X POST https://import.{region}.commercetools.com/{projectKey}/categories/import-containers/{importContainerKey} -i \--header 'Authorization: Bearer ${BEARER_TOKEN}' \--header 'Content-Type: application/json' \--data-binary @- << DATA{"type" : "category","resources" : [ {"key" : "greatTestCat","name" : {"en" : "greatTestCat"},"slug" : {"en" : "great-slug"},"description" : {"de" : "Beschreibung der Kategorie","en" : "category's description"},"parent" : {"typeId" : "category","key" : "category-key"},"orderHint" : "category's order hint","externalId" : "external-id","metaTitle" : {"de" : "der Metatitel der Katze","en" : "the cat's meta title"},"metaDescription" : {"de" : "die Meta-Beschreibung der Katze","en" : "the cat's meta description"},"metaKeywords" : {"de" : "die Schlüsselwörter der Katze","en" : "the cat's key words"},"assets" : [ {"key" : "asset-key","sources" : [ {"uri" : "https://google.com","key" : "asset-source-key","dimensions" : {"w" : 12,"h" : 10},"contentType" : "dummy content type"} ],"name" : {"de" : "Asset-Name","en" : "asset name"},"description" : {"de" : "Asset-Beschreibung","en" : "asset description"},"tags" : [ "tag 1" ],"custom" : {"type" : {"key" : "custom-type","typeId" : "type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : false}}}} ],"custom" : {"type" : {"typeId" : "type","key" : "custom-type"},"fields" : {"boolean-field" : {"type" : "Boolean","value" : true},"string-field" : {"type" : "String","value" : "a string"}}}} ]}DATA