December 2018
Intermediate to advanced
500 pages
12h 19m
English
Besides retrieving data, APIs also need to support changes or mutations to the data. There generally are three kinds of mutations:
Mutations follow the general structure of queries:
mutation {
createHotel(name: "Taj", noRooms: 30) {
id
}
}
Here the mutation has a createHotel root field, and it identifies the mutation uniquely. We are giving it the name and noRooms parameters, with the Taj and 30 values respectively. Like a query, the payload here describes what we want in terms of the properties of the newly created object; here we are asking for the ID of the new person.
Continuing with our hotel example in graphql-go, the mutation root object defines all the various ...
Read now
Unlock full access