Skip to content

Commit dcd725e

Browse files
authored
Update graphql.md
1 parent 6362281 commit dcd725e

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

doc/graphql.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ $client->authenticate($token, null, Github\Client::AUTH_ACCESS_TOKEN);
1919
$result = $client->api('graphql')->execute($query);
2020
```
2121

22+
#### Use different `Accept` Headers
23+
You can preview upcoming features and changes to the GitHub GraphQL schema before they are added to the GitHub GraphQL API.
24+
To access a schema preview, you'll need to provide a custom media type in the Accept header for your requests. Feature documentation for each preview specifies which custom media type to provide. More info about [Schema Previews](https://docs.github.com/en/graphql/overview/schema-previews).
25+
26+
To use [GitHub v4 API (GraphQL API)](http://developer.github.com/v4/) with different `Accept` header you can pass third argument to execute method.
27+
28+
```php
29+
$result = $client->api('graphql')->execute($query, [], 'application/vnd.github.starfox-preview+json')
30+
```
31+
> default accept header is `application/vnd.github.v4+json`
32+
33+
34+
2235
#### Use variables
2336

2437
[Variables](https://developer.github.com/v4/guides/forming-calls/#working-with-variables) allow specifying of requested data without dynamical change of a query on a client side.

0 commit comments

Comments
 (0)