Queries and mutations for managing Types in the platform.
Queries
Query Types
QUERYtypeDefinitions
| Arguments | |
|---|---|
whereString | |
sortArray of String | |
limitInt | |
offsetInt | |
Output:TypeDefinitionQueryResult
Get Type
QUERYtypeDefinition
| Arguments | |
|---|---|
idString | Queries with specified ID |
keyString | Queries with specified key |
Output:TypeDefinition
Mutations
Create Type
Update Type
MUTATIONupdateTypeDefinition
| Arguments | |
|---|---|
versionLong | |
actionsArray of TypeUpdateAction | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Output:TypeDefinition
Delete Type
MUTATIONdeleteTypeDefinition
| Arguments | |
|---|---|
versionLong | |
idString | Queries with specified ID |
keyString | Queries with specified key |
Output:TypeDefinition
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.
keyString | |
nameString | |
descriptionString | |
nameAllLocalesArray of LocalizedString | |
descriptionAllLocalesArray of LocalizedString | |
resourceTypeIdsArray of String | |
fieldDefinitionsArray of FieldDefinition | |
idString | |
versionLong | |
createdAt | |
lastModifiedAt | |
createdBy | |
lastModifiedBy |
TypeDefinitionQueryResult
offsetInt | |
countInt | |
totalLong | |
existsBoolean | |
resultsArray of TypeDefinition |
FieldDefinition
Field definitions describe custom fields and allow you to define some meta-information associated with the field.
nameString | 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. |
requiredBoolean | 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 |
labelString | A human-readable label for the field. |
labelAllLocalesArray of LocalizedString | A human-readable label for the field. |
type | Data type of the Custom Field to define. |
TextInputHint
SingleLineMultiLine
FieldType
nameString |
BooleanType
nameString |
DateTimeType
nameString |
DateType
nameString |
EnumType
valuesArray of EnumValue | |
nameString |
EnumValue
keyString | |
labelString |
LocalizedEnumType
valuesArray of LocalizedEnumValue | |
nameString |
LocalizedEnumValue
keyString | |
labelString | |
labelAllLocalesArray of LocalizedString |
LocalizedStringType
nameString |
MoneyType
nameString |
NumberType
nameString |
ReferenceType
In GraphQL,
referenceTypeId is a String, not an enum. It accepts the values listed in CustomFieldReferenceValue.referenceTypeIdString | |
nameString |
SetType
elementType | |
nameString |
StringType
nameString |
TimeType
nameString |
Input types
TypeDefinitionDraft
keyString | |
nameArray of LocalizedStringItemInputType | |
descriptionArray of LocalizedStringItemInputType | |
resourceTypeIdsArray of String | |
fieldDefinitionsArray of FieldDefinitionInput |
FieldDefinitionInput
type | |
nameString | |
labelArray of LocalizedStringItemInputType | |
requiredBoolean | |
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.String | |
LocalizedString | |
Number | |
Money | |
Date | |
Time | |
DateTime | |
Boolean | |
Enum | |
LocalizedEnum | |
Reference |
FieldTypeEnumTypeDraft
valuesArray of EnumValueInput |
FieldTypeLocalizedEnumTypeDraft
valuesArray of LocalizedEnumValueInput |
FieldTypeReferenceTypeDraft
referenceTypeIdString |
FieldTypeSetTypeDraft
elementType |
FieldTypeSetElementTypeDraft
String | |
LocalizedString | |
Number | |
Money | |
Date | |
Time | |
DateTime | |
Boolean | |
Enum | |
LocalizedEnum | |
Reference |
SimpleFieldTypeDraft
dummyString |
EnumValueInput
keyString | |
labelString |
LocalizedEnumValueInput
keyString | |
labelArray of LocalizedStringItemInputType |
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
fieldNameString | |
keysArray 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
fieldNameString | |
keysArray of String |
Add Enum Value
fieldNameString | |
value |
Add Field Definition
fieldDefinition |
Add Localized Enum Value
fieldNameString | |
value |
Change Enum Value Label
fieldNameString | |
value |
Change Enum Value Order
fieldNameString | |
keysArray of String |
Change Label
fieldNameString | |
labelArray of LocalizedStringItemInputType |
Change Field Definition Order
fieldNamesArray of String |
Change Input Hint
fieldNameString | |
inputHint | Can be SingleLine, or MultiLine |
Change Localized Enum Value Label
fieldNameString | |
value |
Change Localized Enum Value Order
fieldNameString | |
keysArray of String |
Change Key
keyString |
Change Name
nameArray of LocalizedStringItemInputType |
Remove Field Definition
fieldNameString |
Set Description
descriptionArray of LocalizedStringItemInputType |