Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions site/docs/BestPractice-ServingOverHTTP.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This request could be sent via an HTTP GET like so:
http://myapi/graphql?query={me{name}}
```

Query variables can be sent as a JSON-encoded string in an additional query parameter called `variables`.
Query variables can be sent as a JSON-encoded string in an additional query parameter called `variables`. If the query contains several named operations, an `operationName` query parameter can be used to control which one should be executed.

#### POST request

Expand All @@ -44,10 +44,13 @@ A standard GraphQL POST request should use the `application/json` content type,
```js
{
"query": "...",
"variables": { variable1: value, ... }
"operationName": "...",
"variables": { variable1: value, ... }
}
```

`operationName` and `variables` are optional fields. `operationName` is only required if multiple operations are present in the query.

In addition to the above, we recommend supporting two additional cases:

* If the "query" query string parameter is present (as in the GET example above), it should be parsed and handled in the same way as the HTTP GET case.
Expand Down