Skip to content

Instantly share code, notes, and snippets.

@mtvspec
Last active July 19, 2020 17:56
Show Gist options
  • Save mtvspec/d9e1a83cb51446825b196b75a6b45671 to your computer and use it in GitHub Desktop.
Save mtvspec/d9e1a83cb51446825b196b75a6b45671 to your computer and use it in GitHub Desktop.
GraphQL Mutation Example
mutation createBook($data: BookInput!) {
createBook(data: $data) {
id
title
description
}
}
{
"data": {
"title": "Book 4",
"author": 1
}
}
mutation updateBook($id: ID! $data: BookInput!) {
updateBook(id: $id data: $data) {
id
title
description
}
}
{
"id": 1,
"data": {
"title": "Book 1",
"description": "Book description",
"author": 1
}
}
mutation deleteBook($id: ID!) {
deleteBook(id: $id) {
id
title
}
}
{
"id": 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment