Repository navigation
Improve gh api short flag output to mention @ support #9966
Description
Activity
Hey @jsoref,
Is the
--inputflag insufficient for your use case?--input file The file to use as body for the HTTP request (use "-" to read from standard input)I'm honestly not sure how it interacts with -
f, but based on your curl I'm also not sure if you need it? Happy to spend time doing further investigation if it is something you need.Cheers.
- addedmore-info-neededMore info needed from user/contributorMore info needed from user/contributorgh-apirelating to the gh api commandrelating to the gh api command
on Nov 29, 2024 I couldn't tell. If it works, it needs to be documented in the
-fdocumentation.I couldn't tell. If it works, it needs to be documented in the -f documentation.
Actually it looks like it's covered in the Long description:
To pass pre-constructed JSON or payloads in other formats, a request body may be read
from file specified by--input. Use-to read from standard input. When passing the
request body this way, any parameters specified via field flags are added to the query
string of the endpoint URL.And in fact, in the
-F/--fieldflag part in the long description it says:if the value starts with
@, the rest of the value is interpreted as a
filename to read the value from. Pass-to read from standard input.Which I had no idea about!
This looks like it satisfies the same feature as curl right?
- changed the title
[-]Provide an equivalent to `curl`'s `-d @filename` for at least `gh api`[/-][+]Improve `gh api` short flag output to mention `@` support[/+]on Nov 29, 2024 Hmm, it sounds like the feature is indeed there. I'd argue that the
@stuff should be hinted in the summary just as-is for-i:-F, --field key=value Add a typed parameter in key=value format -H, --header key:value Add a HTTP request header in key:value format --hostname string The GitHub hostname for the request (default "github.com") -i, --include Include HTTP response status line and headers in the output --input file The file to use as body for the HTTP request (use "-" to read from standard input)Reacted by Glenn 'devalias' Grant- linked a pull request that will close this issueImprove `api` command docs around `--input` and `--field` #12062
on Oct 31, 2025
Describe the feature or problem you’d like to solve
I'm trying to submit a ~200KB SARIF file to the upload SARIF endpoint.
Using
ghinvolves constructing the entire payload as a command-line, and shells don't really approve of 200KB command-lines...Proposed solution
Add some syntax to allow passing data via a file instead of expanded on a command line will allow users to use
ghto submit large SARIF files (and probably other payloads) instead of resorting tocurl.(check-spelling is currently on the fence and uses
ghsome of the time andcurlsome of the time.)Additional context
Trying to use
ghfails miserably:https://github.com/check-spelling-sandbox/terminal/actions/runs/12045375307/job/33583882502#step:2:14473
Using
curlworks:https://github.com/check-spelling-sandbox/terminal/actions/runs/12046644392/job/33587535642#step:2:13835