A GraphQL mutation is an operation for changing existing data or adding new data. Like an SQL UPDATE or INSERT, or a REST PUT or POST, it accepts parameters and can return data with the update. section 4.4
Mutations differ from read-only queries in several practical ways:
- Declare the operation with the mutation keyword. section 4.5.2
- Pass input arguments, such as a CarInput object containing the fields needed to create a car. section 4.5.2
- Select fields from the returned object; complex return types require an explicit field selection. section 4.5.2
- Return the stored object, including generated values such as an ID, when those fields are selected. section 4.5.2
Registering a car
A register mutation adds a Peugeot 406 to a fleet and requests the returned license plate, model, manufacturer, and ID. The response echoes those values and includes the generated ID 3. Running the cars query afterward verifies that the database contains the new car. section 4.5.2
Figure 4.3 GraphiQL is an HTML and JavaScript-based UI for manually executing GraphQL operations.
Use GraphiQL to enter, autocomplete, execute, and review GraphQL mutations through a browser-based interface. section 4.5.2

