Fluent Commerce Logo
Docs
Sign In

GraphQL (GQL) Mutations

Essential knowledge

Author:

Fluent Commerce

Changed on:

5 Apr 2024

Overview

Mutations in GraphQL are operations designed to modify server-side data, encompassing the creation, updating, or deletion of records. They play a critical role in dynamic data management within GraphQL applications, allowing for precise and controlled data manipulation.

Key points

  • Mutations in GraphQL are used for creating, updating, or deleting data, and are crucial for any operation that changes server-side information.
  • Create mutations always generate data with a "CREATED" status, which can trigger orchestration events for workflow processes.
  • Update mutations require mandatory parameters to uniquely identify and modify existing data entries.

Mutations

A GraphQL mutation is a type of operation used to modify data on the server. While queries are used to fetch data, mutations are used to create, update, or delete data. 

Mutation Operations

Mutation operations are used for creating or updating data. All mutation operations take a single parameter and have the naming convention:

`<<mutationName>>(<<MutationNameInput>>):<<Type>>`
.

Examples:

  • `createOrder(CreateOrderInput): Order // Create Order mutation`
  • `updateOrder(UpdateOrderInput): Order // Update Order mutation`
Create

Create mutations are used to create new data.

  • Every create mutation creates the data in the “CREATED” status. This enables the clients to trigger orchestrations for that object. If the client wishes to change the status of any object after creation, Fluent recommends using the update mutation to do so. This could be particularly helpful when a client creates objects of types that cannot be orchestrated. For example, Customer.
  • All objects of orchestrate-able types fire orchestration events on creation. This can be used to trigger workflows.
Update

Update mutations are used for updating existing data.

  • Input types for update mutations have mandatory parameters that are used to identify the object to be updated uniquely.

Copyright © 2024 Fluent Retail Pty Ltd (trading as Fluent Commerce). All rights reserved. No materials on this docs.fluentcommerce.com site may be used in any way and/or for any purpose without prior written authorisation from Fluent Commerce. Current customers and partners shall use these materials strictly in accordance with the terms and conditions of their written agreements with Fluent Commerce or its affiliates.

Fluent Logo