You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**Note**: The concept of _preview headers_ has been deprecated from REST API endpoints hosted via `api.github.com` but it still exists in GHES (GitHub Enterprise Server) version 3.2 and below. Instead of using _preview headers_ going forward, new features are now being tested using beta previews that users will have to opt-in to.
520
-
521
-
Media type previews and formats can be set using `mediaType: { format, previews }` on every request. Required API previews are set automatically on the respective REST API endpoint methods.
522
-
523
-
Example: retrieve the raw content of a `package.json` file
524
-
525
-
```js
526
-
const { data } =awaitoctokit.rest.repos.getContent({
const { data } =awaitoctokit.rest.repos.getContent({
541
-
mediaType: {
542
-
previews: ["mercy"],
543
-
},
544
-
owner:"octocat",
545
-
repo:"hello-world",
546
-
});
547
-
console.log("topics on octocat/hello-world: %j", data.topics);
548
-
```
549
-
550
-
Learn more about [Media type formats](https://docs.github.com/en/rest/overview/media-types) and [previews](https://docs.github.com/en/[email protected]/rest/overview/api-previews) used on GitHub Enterprise Server.
551
-
552
515
### GraphQL API queries
553
516
554
517
Octokit also supports GitHub's GraphQL API directly -- you can use the same queries shown in the documentation and available in the GraphQL explorer in your calls with `octokit.graphql`.
0 commit comments