Skip to main content

GraphQL Mutations

As a complete platform, we focus not just on querying but creating and updating your app's data. Similar to queries, mutations must also have data/fields selected. You can ask for any nested fields. This is useful for fetching the new state of an object after an update.

Form a mutation#

You must specify three things when defining a mutation:

  1. Name of the mutation, typically named after the type of modification you want to perform e.g.CreateToDo...but it can be anything you want.

  2. The Input variable, passed as an argument to the mutation name that contains the data you want to send to the server.

  3. Payload object, the data you want to send to the server.

mutation CreateTodo( $todos: [TodoInput!]!) {
createTodo(todo: $todo) {
hypi {
id
created
}
description
completed
}
}