Sitecore GraphQL Mutations: A Complete Guide
Introduction While queries handle data retrieval in GraphQL, mutations are responsible for creating, updating, and deleting content in Sitecore. Let's explore how to effectively use Mutations in Sitecore. 1. Create Mutation: mutation CreateItem { createItem( name: "New Item to be Created" template: "{4330C04F-5CAA-4E93-A2B2-634900395E51}" parent: "{C081F940-3F38-4E10-8F43-B80AA63BC1BA}" language: "en" fields: [ { name: "title", value: "'New Item Created with Mutations'" } { name: "subtitle" value: "'This is Sitecore New Item Created with Mutations'" } ] ) { path id } } In this example: createItem is a mutation function that creates a new item. name is the name of the new item. parentId is the ID of the parent item under which...