Queries and mutations for managing Types in the platform.

Queries

Query Types

QUERYtypeDefinitions
Arguments
where​
String​
sort​
Array of String​
limit​
Int​
offset​
Int​

Get Type

QUERYtypeDefinition
Arguments
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Mutations

Create Type

MUTATIONcreateTypeDefinition
Arguments
draft​

Update Type

MUTATIONupdateTypeDefinition
Arguments
version​
Long​
actions​
Array of TypeUpdateAction​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Delete Type

MUTATIONdeleteTypeDefinition
Arguments
version​
Long​
id​
String​

Queries with specified ID

key​
String​

Queries with specified key

Output types

TypeDefinition

This type is equivalent to Type in REST.
In GraphQL, resourceTypeIds is a list of String values, not an enum. It accepts the values listed in ResourceTypeId.

Types allow you to define additional project-specific fields on resources and data types, so-called Custom Fields.

key​
String​
name​
String​
description​
String​
nameAllLocales​
Array of LocalizedString​
descriptionAllLocales​
Array of LocalizedString​
resourceTypeIds​
Array of String​
fieldDefinitions​
Array of FieldDefinition​
id​
String​
version​
Long​
createdAt​
lastModifiedAt​
createdBy​
lastModifiedBy​

TypeDefinitionQueryResult

offset​
Int​
count​
Int​
total​
Long​
exists​
Boolean​
results​
Array of TypeDefinition​

FieldDefinition

Field definitions describe custom fields and allow you to define some meta-information associated with the field.

name​
String​
Name of the Custom Field to define. Must be unique for a given ResourceTypeId. If a FieldDefinition with the same name is defined in another Type for the same ResourceTypeId, then both FieldDefinitions must have the same type.
required​
Boolean​

Defines whether the field is required to have a value.

inputHint​
Defines the visual representation of the field in user interfaces like the Merchant Center. It is only relevant for string-based FieldTypes like CustomFieldStringType and CustomFieldLocalizedStringType.
Can be SingleLine, or MultiLine​
label​
String​

A human-readable label for the field.

labelAllLocales​
Array of LocalizedString​

A human-readable label for the field.

type​

Data type of the Custom Field to define.

TextInputHint

SingleLine
MultiLine

FieldType

name​
String​

BooleanType

name​
String​

DateTimeType

name​
String​

DateType

name​
String​

EnumType

values​
Array of EnumValue​
name​
String​

EnumValue

key​
String​
label​
String​

LocalizedEnumType

values​
Array of LocalizedEnumValue​
name​
String​

LocalizedEnumValue

key​
String​
label​
String​
labelAllLocales​
Array of LocalizedString​

LocalizedStringType

name​
String​

MoneyType

name​
String​

NumberType

name​
String​

ReferenceType

In GraphQL, referenceTypeId is a String, not an enum. It accepts the values listed in CustomFieldReferenceValue.
referenceTypeId​
String​
name​
String​

SetType

elementType​
name​
String​

StringType

name​
String​

TimeType

name​
String​

Input types

TypeDefinitionDraft

key​
String​
name​
description​
resourceTypeIds​
Array of String​
fieldDefinitions​

FieldDefinitionInput

type​
name​
String​
label​
required​
Boolean​
inputHint​
Can be SingleLine, or MultiLine​

FieldTypeInput

REST identifies the Field type with a name field. In GraphQL, the input has one field per Field type instead: String, LocalizedString, Number, Money, Date, Time, DateTime, Boolean, Enum, LocalizedEnum, Reference, and Set. These names match the name values of FieldType in REST.
Set​
String​
LocalizedString​
Number​
Money​
Date​
Time​
DateTime​
Boolean​
Enum​
LocalizedEnum​
Reference​

FieldTypeEnumTypeDraft

values​
Array of EnumValueInput​

FieldTypeLocalizedEnumTypeDraft

values​

FieldTypeReferenceTypeDraft

referenceTypeId​
String​

FieldTypeSetTypeDraft

elementType​

FieldTypeSetElementTypeDraft

String​
LocalizedString​
Number​
Money​
Date​
Time​
DateTime​
Boolean​
Enum​
LocalizedEnum​
Reference​

SimpleFieldTypeDraft

dummy​
String​

EnumValueInput

key​
String​
label​
String​

LocalizedEnumValueInput

key​
String​
label​

TypeUpdateAction

removeEnumValues​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
removeLocalizedEnumValues​
BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
addEnumValue​
addFieldDefinition​
addLocalizedEnumValue​
changeEnumValueLabel​
changeEnumValueOrder​
changeLabel​
changeFieldDefinitionOrder​
changeInputHint​
changeLocalizedEnumValueLabel​
changeLocalizedEnumValueOrder​
changeKey​
changeName​
removeFieldDefinition​
setDescription​

Update actions

Remove Enum Values

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
fieldName​
String​
keys​
Array of String​

Remove Localized Enum Values

BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta
fieldName​
String​
keys​
Array of String​

Add Enum Value

fieldName​
String​
value​

Add Field Definition

fieldDefinition​

Add Localized Enum Value

fieldName​
String​
value​

Change Enum Value Label

fieldName​
String​
value​

Change Enum Value Order

fieldName​
String​
keys​
Array of String​

Change Label

fieldName​
String​
label​

Change Field Definition Order

fieldNames​
Array of String​

Change Input Hint

fieldName​
String​
inputHint​
Can be SingleLine, or MultiLine​

Change Localized Enum Value Label

fieldName​
String​
value​

Change Localized Enum Value Order

fieldName​
String​
keys​
Array of String​

Change Key

key​
String​

Change Name

name​

Remove Field Definition

fieldName​
String​

Set Description

description​