Create and update Categories in your Project.
The Category data to import is represented by CategoryImport and included in a CategoryImportRequest, which is imported using Import Categories.
Representations
CategoryImportRequest
The request body to import Categories. Contains data for Categories to be created or updated in a Project.
type | category The resource types that can be imported. |
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": {
"exampleBooleanField": {
"type": "Boolean",
"value": false
}
}
}
}
],
"custom": {
"type": {
"typeId": "type",
"key": "custom-type"
},
"fields": {
"exampleBooleanField": {
"type": "Boolean",
"value": true
},
"exampleStringField": {
"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 | User-defined unique identifier. If a Category with this 2 MaxLength: 256 Pattern: ^[A-Za-z0-9_-]+$ |
externalId String | Maps to |
name | Maps to |
slug | Maps to |
description | Maps to |
parent | Maps to |
orderHint String | Maps to |
metaTitle | Maps to |
metaDescription | Maps to |
metaKeywords | Maps to |
assets Array of Asset | Maps to |
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 Project key. |
importContainerKey String | The ImportContainer used to create the new resource |
application/json
ImportResponse
application/json
curl 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" : {
"exampleBooleanField" : {
"type" : "Boolean",
"value" : false
}
}
}
} ],
"custom" : {
"type" : {
"typeId" : "type",
"key" : "custom-type"
},
"fields" : {
"exampleBooleanField" : {
"type" : "Boolean",
"value" : true
},
"exampleStringField" : {
"type" : "String",
"value" : "a string"
}
}
}
} ]
}
DATA
{
"operationStatus": [
{
"state": "processing",
"operationId": "252c6ed3-c668-4610-afe9-87b9255e62e0"
}
]
}