All Release Notes

Category and Product Mutations added

2 October 2018
Enhancement
GraphQLProduct Catalog

It is now possible to create/update/delete categories as well as products via GraphQL API.

  • [GraphQL API] Type Mutation was changed:
    • Field createCategory was added to Mutation type
    • Field updateCategory was added to Mutation type
    • Field deleteCategory was added to Mutation type
    • Field createProduct was added to Mutation type
    • Field updateProduct was added to Mutation type
    • Field deleteProduct was added to Mutation type

Additionally the following query fields where added:

  • [GraphQL API] Type Category was changed:

    • Field assets was added to Category type
  • [GraphQL API] Type ProductVariant was changed:

    • Field assets was added to ProductVariant type
  • [GraphQL API] Type ProductPrice was changed:

    • Field tiers was added to ProductPrice type

Following changes were introduced in the GraphQL schema:

  • only a subset is shown
  • changes are shown in GraphQL Schema Definition Language
extend type Mutation {
createCategory(draft: CategoryDraft!): Category
updateCategory(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, version: Long!, actions: [CategoryUpdateAction!]!): Category
deleteCategory(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, version: Long!): Category
createProduct(draft: ProductDraft!): Product
updateProduct(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, version: Long!, actions: [ProductUpdateAction!]!): Product
deleteProduct(
"Queries with specified ID"
id: String,
"Queries with specified key"
key: String, version: Long!): Product
}
input CategoryUpdateAction {
addAsset: AddCategoryAsset
changeAssetName: ChangeCategoryAssetName
changeAssetOrder: ChangeCategoryAssetOrder
changeName: ChangeCategoryName
changeOrderHint: ChangeCategoryOrderHint
changeSlug: ChangeCategorySlug
changeParent: ChangeCategoryParent
removeAsset: RemoveCategoryAsset
setAssetCustomField: SetCategoryAssetCustomField
setAssetCustomType: SetCategoryAssetCustomType
setAssetDescription: SetCategoryAssetDescription
setAssetKey: SetCategoryAssetKey
setAssetSources: SetCategoryAssetSources
setAssetTags: SetCategoryAssetTags
setCustomField: SetCategoryCustomField
setCustomType: SetCategoryCustomType
setDescription: SetCategoryDescription
setKey: SetCategoryKey
setMetaDescription: SetCategoryMetaDescription
setMetaKeywords: SetCategoryMetaKeywords
setMetaTitle: SetCategoryMetaTitle
setExternalId: SetCategoryExternalId
}
input ProductUpdateAction {
moveImageToPosition: MoveProductImageToPosition
setSearchKeywords: SetSearchKeywords
revertStagedChanges: RevertStagedChanges
revertStagedVariantChanges: RevertStagedVariantChanges
publish: PublishProduct
unpublish: UnpublishProduct
transitionState: TransitionProductState
addAsset: AddProductAsset
addExternalImage: AddProductExternalImage
addPrice: AddProductPrice
addToCategory: AddProductToCategory
addVariant: AddProductVariant
changeAssetName: ChangeProductAssetName
changeAssetOrder: ChangeProductAssetOrder
changeMasterVariant: ChangeProductMasterVariant
changeImageLabel: ChangeProductImageLabel
changeName: ChangeProductName
changePrice: ChangeProductPrice
changeSlug: ChangeProductSlug
removeAsset: RemoveProductAsset
removeFromCategory: RemoveProductFromCategory
removeImage: RemoveProductImage
removePrice: RemoveProductPrice
removeVariant: RemoveProductVariant
setAssetCustomField: SetProductAssetCustomField
setAssetCustomType: SetProductAssetCustomType
setAssetDescription: SetProductAssetDescription
setAssetKey: SetProductAssetKey
setAssetSources: SetProductAssetSources
setAssetTags: SetProductAssetTags
setCategoryOrderHint: SetProductCategoryOrderHint
setDiscountedPrice: SetProductDiscountedPrice
setAttribute: SetProductAttribute
setAttributeInAllVariants: SetProductAttributeInAllVariants
setDescription: SetProductDescription
setImageLabel: SetProductImageLabel
setKey: SetProductKey
setMetaAttributes: SetProductMetaAttributes
setMetaDescription: SetProductMetaDescription
setMetaKeywords: SetProductMetaKeywords
setMetaTitle: SetProductMetaTitle
setProductPriceCustomField: SetProductPriceCustomField
setProductPriceCustomType: SetProductPriceCustomType
setPrices: SetProductPrices
setSku: SetProductSku
setTaxCategory: SetProductTaxCategory
setProductVariantKey: SetProductVariantKey
}
extend type ProductVariant {
assets: [Asset!]!
}
extend type Category {
assets: [Asset!]!
}
type Asset {
id: String!
key: String
sources: [AssetSource!]!
name(
"String is define 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(
locale: Locale,
acceptLanguage: [Locale!]): String
descriptionAllLocales: [LocalizedString!]
tags: [String!]!
}
type AssetSource {
uri: String!
key: String
dimensions: AssetDimensions
contentType: String
}
type AssetDimensions {
width: Int!
height: Int!
}