Skip to content

Commit

Permalink
Mention batching in GraphQL endpoint docs
Browse files Browse the repository at this point in the history
  • Loading branch information
paf31 committed Dec 5, 2019
1 parent 2c71c7d commit 9fbbddd
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions docs/graphql/manual/api-reference/graphql-api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,60 @@ The following types of requests can be made using the GraphQL API:
- :doc:`Query / Subscription <query>`
- :doc:`Mutation <mutation>`

Batching requests
-----------------

The GraphQL API provides support for batched queries and mutations. The endpoint will accept
an array of requests in place of a single request, and return an array of corresponding
responses.

**Example:** using a client which supports batching (such as Apollo Client), we can send two
queries in one request:

.. graphiql::
:view_only:
:query:
query first {
author(where: {id: {_eq: 1}}) {
id
name
}
}
query second {
author(where: {id: {_eq: 2}}) {
id
name
}
}
:response:
[
{
"data": {
"author": [
{
"id": 1,
"name": "Justin"
}
]
}
},
{
"data": {
"author": [
{
"id": 2,
"name": "Beltran"
}
]
}
}
]


.. toctree::
:maxdepth: 1
:hidden:

Query / Subscription <query>
Mutation <mutation>
Batching requests <batching>

0 comments on commit 9fbbddd

Please sign in to comment.