Representations
TypeImportRequest
type | type The resource types that can be imported. |
resources Array of TypeImport | The type import resources of this request. MaxItems:20 |
TypeImport
key String | User-defined unique identifier for the Type. If a Type with this MinLength: key exists, it will be updated with the imported data.2 MaxLength: 256 Pattern: ^[A-Za-z0-9_-]+$ |
name | Maps to Type.name . |
description | Maps to Type.description . |
resourceTypeIds Array of ResourceTypeId | Maps to MinItems: Type.resourceTypeIds . This value cannot be changed after the Type is imported.1 |
fieldDefinitions Array of FieldDefinition | Maps to Type.fieldDefinitions . |
ResourceTypeId
Type.resourceTypeIds
.address
asset
business-unit
cart-discount
category
channel
customer
customer-group
custom-line-item
discount-code
inventory-entry
line-item
order
- Cart and Order. When a Cart is ordered, the CustomFields need to be copied to the Order. For this reason, the Types for Carts are also valid for Orders, and hence both have the same identifier:
order
. order-edit
order-delivery
order-parcel
order-return-item
payment
payment-interface-interaction
product-price
product-selection
quote
- Quote, QuoteRequest and StagedQuote. When a StagedQuote is created, the CustomFields will be copied from the QuoteRequest and when a Quote is created, the CustomFields will be copied from the StagedQuote. For this reason, the Types for Quotes are also valid for QuoteRequests and StagedQuotes, and hence all have the same identifier:
quote
. review
shipping
shipping-method
shopping-list
shopping-list-text-line-item
standalone-price
store
transaction
FieldDefinition
Type.FieldDefinition
.type | Data type of the Custom Field to define. |
name String | Name of the Custom Field to define. Must be unique for a given ResourceTypeId. In case there is a FieldDefinition with the same MinLength: name in another Type, both FieldDefinitions must have the same type . This value cannot be changed after the Type is imported.2 MaxLength: 36 Pattern: ^[A-Za-z0-9_-]+$ |
label | A human-readable label for the field. |
required Boolean | Defines whether the field is required to have a value. This value cannot be changed after the Type is imported. |
inputHint | Provides a visual representation type for this field. It is only relevant for string-based field types like CustomFieldStringType and CustomFieldLocalizedStringType. Default: SingleLine |
TypeTextInputHint
SingleLine
Hint for GUIs to display the field's content in a single line of text.
MultiLine
Hint for GUIs to display the field's content over multiple lines of text.
FieldType
name
field.values
for enum types or elementType
for set type fields.CustomFieldBooleanType
Field type for Boolean values.
name String | "Boolean" |
CustomFieldDateTimeType
name String | "DateTime" |
CustomFieldDateType
name String | "Date" |
CustomFieldEnumType
Field type for enum values.
name String | "Enum" |
values Array of CustomFieldEnumValue | Allowed values. |
CustomFieldLocalizedEnumType
Field type for localized enum values.
name String | "LocalizedEnum" |
values Array of CustomFieldLocalizedEnumValue | Allowed values. |
CustomFieldLocalizedStringType
name String | "LocalizedString" |
CustomFieldMoneyType
name String | "Money" |
CustomFieldNumberType
Field type for number values.
name String | "Number" |
CustomFieldReferenceType
name String | "Reference" |
referenceTypeId | Resource type the Custom Field can reference. |
CustomFieldSetType
elementType
(without duplicate elements).name String | "Set" |
elementType | Field type of the elements in the set. |
CustomFieldStringType
Field type for string values.
name String | "String" |
CustomFieldTimeType
name String | "Time" |
CustomFieldEnumValue
key String | Key of the value used as a programmatic identifier. |
label String | Descriptive label of the value. |
CustomFieldLocalizedEnumValue
key String | Key of the value used as a programmatic identifier. |
label | Descriptive localized label of the value. |
CustomFieldReferenceValue
associate-role
business-unit
cart
category
channel
customer
customer-group
key-value-document
order
product
product-type
review
state
shipping-method
zone
Import Types
Creates a request for creating new Type or updating existing ones.
manage_project:{projectKey}
manage_types:{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}/types/import-containers/{importContainerKey} -i \
--header "Authorization: Bearer ${BEARER_TOKEN}" \
--header 'Content-Type: application/json' \
--data-binary @- << DATA
{
"type" : "type",
"resources" : [ {
"key" : "type-key",
"name" : {
"en" : "Name of type"
},
"description" : {
"en" : "Description of type"
},
"resourceTypeIds" : [ "customer" ],
"fieldDefinitions" : [ {
"type" : {
"name" : "String"
},
"name" : "exampleStringField",
"label" : {
"en" : "Example string field."
},
"required" : false,
"inputHint" : "SingleLine"
} ]
} ]
}
DATA