Let's study an example of a mutation allowed by the GitHub API: adding a star to a repository. This mutation is called addStar and accepts a single input parameter: the repository ID to be starred. It can return information of the Starrable type ("Things that can be starred" according to the documentation). The full query is written as follows:
mutation {
addStar(input: {starrableId: "<REPOSITORY_ID>"}) {
starrable {
stargazers(last: 1) {
nodes {
login
}
}
}
}
}
Similarly to the queries, the arguments and returned parameters for each mutation are defined in the GraphQL schema, whose documentation is accessible through the right panel in the GraphQL playground.
We will see more examples of mutations in the next section.
Despite its name, GraphQL is not tied to a graph database and can be used with a SQL database backend. With Python, check the graphene module to learn more.
Neo4j used to maintain...