1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/gh-api.md
Vitor Henrique 46a054215a
pages*: make help and version commands comply with the style guide (#12107)
* pages*: use generic word for help

* git: add newline to the end

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>

* pages*: make help and version commands comply with the style guide

* java: fix Java name

---------

Co-authored-by: K.B.Dharun Krishna <kbdharunkrishna@gmail.com>
2024-01-30 12:55:24 +08:00

36 lines
977 B
Markdown

# gh api
> Makes authenticated HTTP requests to the GitHub API and prints the response.
> More information: <https://cli.github.com/manual/gh_api>.
- Display the releases for the current repository in JSON format:
`gh api repos/:owner/:repo/releases`
- Create a reaction for a specific issue:
`gh api --header {{Accept:application/vnd.github.squirrel-girl-preview+json}} --raw-field '{{content=+1}}' {{repos/:owner/:repo/issues/123/reactions}}`
- Display the result of a GraphQL query in JSON format:
`gh api graphql --field {{name=':repo'}} --raw-field '{{query}}'`
- Send a request using a custom HTTP method:
`gh api --method {{POST}} {{endpoint}}`
- Include the HTTP response headers in the output:
`gh api --include {{endpoint}}`
- Do not print the response body:
`gh api --silent {{endpoint}}`
- Send a request to a specific GitHub Enterprise Server:
`gh api --hostname {{github.example.com}} {{endpoint}}`
- Display the subcommand help:
`gh api --help`