From 82b8f3bd08f39bb3539babf549154d120c2937f1 Mon Sep 17 00:00:00 2001 From: Axel Navarro Date: Sat, 16 Jan 2021 14:03:57 -0300 Subject: [PATCH] gh-api: add page (#5127) --- pages/common/gh-api.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 pages/common/gh-api.md diff --git a/pages/common/gh-api.md b/pages/common/gh-api.md new file mode 100644 index 0000000000..1326d737f3 --- /dev/null +++ b/pages/common/gh-api.md @@ -0,0 +1,36 @@ +# gh api + +> Makes authenticated HTTP requests to the GitHub API and prints the response. +> More information: . + +- Display the subcommand help: + +`gh api --help` + +- 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}}`