4 November 2022
Composable Commerce
HTTP API
New feature
GraphQLProduct catalog

You can now organize related Attributes together into Attributes Groups and ease your product data enhancement workflows.

Changes:

  • [API] Added Attribute Groups API.
  • [API] Added the view_attribute_groups and manage_attribute_groups OAuth scopes.
  • [GraphQL API] Added the following types to the GraphQL schema: AddAttributeGroupAttribute, AttributeGroup, AttributeGroupDraft, AttributeGroupQueryResult, AttributeGroupUpdateAction, ChangeAttributeGroupName, RemoveAttributeGroupAttribute, SetAttributeGroupAttributes, SetAttributeGroupDescription, SetAttributeGroupKey, AttributeReference.
  • [GraphQL API] Changed the Query type:
    • Added the attributeGroups field to the Query type.
    • Added the attributeGroup field to the Query type.
  • [GraphQL API] Changed the Mutation type:
    • Added the deleteAttributeGroup field to the Mutation type.
    • Added the updateAttributeGroup field to the Mutation type.
    • Added the createAttributeGroup field to the Mutation type.

The following changes were introduced in terms of GraphQL SDL:

extend type Query {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  attributeGroup(
    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): AttributeGroup

  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  attributeGroups(where: String, sort: [String!], limit: Int, offset: Int): AttributeGroupQueryResult!
}

extend type Mutation {
  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  createAttributeGroup(draft: AttributeGroupDraft!): AttributeGroup

  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  deleteAttributeGroup(version: Long!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): AttributeGroup

  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  updateAttributeGroup(version: Long!, actions: [AttributeGroupUpdateAction!]!,

    "Queries with specified ID"
    id: String,

    "Queries with specified key"
    key: String): AttributeGroup
}

input AttributeReferenceInputType {
  key: String
}

input AddAttributeGroupAttribute {
  attribute: AttributeReference!
}

"BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
type AttributeGroup implements Versioned {
  id: String!
  version: Long!
  createdAt: DateTime!
  lastModifiedAt: DateTime!
  name(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  nameAllLocales: [LocalizedString!]!
  description(
    "String is defined for different locales. This argument specifies the desired locale."
    locale: Locale,

    "List of languages the client is able to understand, and which locale variant is preferred."
    acceptLanguage: [Locale!]): String
  descriptionAllLocales: [LocalizedString!]
  key: String
  attributes: [AttributeReference!]!
  createdBy: Initiator
  lastModifiedBy: Initiator
}

input AttributeGroupDraft {
  name: [LocalizedStringItemInputType!]!
  description: [LocalizedStringItemInputType!]
  key: String
  attributes: [AttributeReferenceInputType!]!
}

type AttributeGroupQueryResult {
  offset: Int!
  count: Int!
  total: Long!

  "BETA: This feature can be subject to change and should be used carefully in production. https://docs.commercetools.com/api/contract#public-beta"
  exists: Boolean!
  results: [AttributeGroup!]!
}

input AttributeGroupUpdateAction {
  addAttribute: AddAttributeGroupAttribute
  changeName: ChangeAttributeGroupName
  removeAttribute: RemoveAttributeGroupAttribute
  setDescription: SetAttributeGroupDescription
  setKey: SetAttributeGroupKey
  setAttributes: SetAttributeGroupAttributes
}

input ChangeAttributeGroupName {
  name: [LocalizedStringItemInputType!]!
}

input RemoveAttributeGroupAttribute {
  attribute: AttributeReferenceInputType!
}

input SetAttributeGroupAttributes {
  attributes: [AttributeReferenceInputType!]!
}

input SetAttributeGroupDescription {
  description: [LocalizedStringItemInputType!]
}

input SetAttributeGroupKey {
  key: String
}