Graphql usage

From wikinotes

HTTP Requests

Graphql is a language, and it's schema is a large file defining all of the available types, queries, and mutations.

# query
curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"query": "query queryTask($id: ID!){ task(id: $id){ name } }", \
       "variables": {"id": "1"}}' \
  http://127.0.0.1:8000
# mutation

curl -X POST \
  -H 'Content-Type: application/json' \
  -d '{"query": "mutation createTask($name: String!){ createTask(name: $desc) { id name } }" \
       "variables": {"name": "clean kitchen"}}' \
  http://127.0.0.1:8000

Web Interfaces

Most graphql API libraries include a web-interface you can interactively compose queries in.
They generally have features like syntax highlighting and tab completion.