graphql-engine/docs/graphql/manual/queries/multiple-queries.rst

52 lines
1003 B
ReStructuredText
Raw Normal View History

Multiple queries in a request
=============================
.. contents:: Table of contents
:backlinks: none
:depth: 2
:local:
2019-09-11 10:17:14 +03:00
If multiple queries are part of the same request, **they are executed in parallel**, the individual responses are
collated and returned. You can fetch objects of different unrelated types in the same query.
2019-02-06 09:39:36 +03:00
**For example**, fetch a list of ``authors`` and a list of ``articles``:
.. graphiql::
:view_only:
:query:
query {
author(limit: 2) {
id
name
}
article(limit: 2) {
id
title
}
}
:response:
{
"data": {
"author": [
{
"id": 1,
"name": "Justin"
},
{
"id": 2,
"name": "Beltran"
}
],
"article": [
{
"id": 1,
"title": "sit amet"
},
{
"id": 2,
"title": "a nibh"
}
]
}
2019-09-11 10:17:14 +03:00
}