younifyd
Menu

updateTypeDefinition

Update an existing type definition — pass its current version and an array of update actions.

Use it in a workflow

  1. Add a step and choose the Commercetools connector.
  2. Pick the updateTypeDefinition action (under Update).
  3. Fill in the fields below, then reference the result from later steps as {{updatetypedefinition.response.data}}.

Query

This is the mutation the action sends by default. Edit it in the step's Query field to change which fields come back.

graphql
mutation UpdateTypeDefinition($version: Long!, $actions: [TypeUpdateAction!]!, $id: String, $key: String) {
  updateTypeDefinition(version: $version, actions: $actions, id: $id, key: $key) {
    key
    nameAllLocales {
      locale
      value
    }
    descriptionAllLocales {
      locale
      value
    }
    resourceTypeIds
    id
    version
    createdAt
    lastModifiedAt
    createdBy {
      isPlatformClient
      clientId
      externalUserId
      anonymousId
      customerRef {
        typeId
        id
      }
      userRef {
        typeId
        id
      }
      associateRef {
        typeId
        id
      }
      attributedTo {
        clientId
        source
        userRef
      }
    }
    lastModifiedBy {
      isPlatformClient
      clientId
      externalUserId
      anonymousId
      customerRef {
        typeId
        id
      }
      userRef {
        typeId
        id
      }
      associateRef {
        typeId
        id
      }
      attributedTo {
        clientId
        source
        userRef
      }
    }
  }
}

Variables

Pass these as a JSON object in the step's Variables field.

versionstringrequired
actionsarray<object>required
addEnumValueobject2 fields
addFieldDefinitionobject1 fields
addLocalizedEnumValueobject2 fields
changeEnumValueLabelobject2 fields
changeEnumValueOrderobject2 fields
changeLabelobject2 fields
changeFieldDefinitionOrderobject1 fields
changeInputHintobject2 fields
changeLocalizedEnumValueLabelobject2 fields
changeLocalizedEnumValueOrderobject2 fields
changeKeyobject1 fields
changeNameobject1 fields
removeFieldDefinitionobject1 fields
setDescriptionobject1 fields
idstring

Queries with specified ID

keystring

Queries with specified key

json
{
  "version": "string",
  "actions": [
    {
      "addEnumValue": {
        "fieldName": "string",
        "value": "string"
      },
      "addFieldDefinition": {
        "fieldDefinition": "string"
      },
      "addLocalizedEnumValue": {
        "fieldName": "string",
        "value": "string"
      },
      "changeEnumValueLabel": {
        "fieldName": "string",
        "value": "string"
      },
      "changeEnumValueOrder": {
        "fieldName": "string",
        "keys": "string"
      },
      "changeLabel": {
        "fieldName": "string",
        "label": "string"
      },
      "changeFieldDefinitionOrder": {
        "fieldNames": "string"
      },
      "changeInputHint": {
        "fieldName": "string",
        "inputHint": "string"
      },
      "changeLocalizedEnumValueLabel": {
        "fieldName": "string",
        "value": "string"
      },
      "changeLocalizedEnumValueOrder": {
        "fieldName": "string",
        "keys": "string"
      },
      "changeKey": {
        "key": "string"
      },
      "changeName": {
        "name": "string"
      }
    }
  ],
  "id": "string",
  "key": "string"
}

Response

Read the result with {{updatetypedefinition.response.data.data.updateTypeDefinition}}. If the API returns errors, the step fails and they are at {{updatetypedefinition.response.data.errors}}.

keystring
nameAllLocalesarray<object>
localeobject
valueobject
descriptionAllLocalesarray<object>
localeobject
valueobject
resourceTypeIdsarray<string>
idstring
versionstring
createdAtstring
lastModifiedAtstring
createdByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields
lastModifiedByobject
isPlatformClientboolean
clientIdstring
externalUserIdstring
anonymousIdstring
customerRefobject2 fields
userRefobject2 fields
associateRefobject2 fields
attributedToobject3 fields

Need more? See the Commercetools guide for connection setup and behaviour shared by every action.