3 ms·
Most of the APIs in normal workflow are hidden behind a token. Is there a way to smooth the workflow for putting tokens in curl command ?
by dprophecyguy 5y ago
Most of the APIs in normal workflow are hidden behind a token.
Is there a way to smooth the workflow for putting tokens in curl command ?
- tyingq 5y agoIf the token is passed as a url parameter in a get request, -G can be useful as it forces the -d key=value switches to append to the url. So that: curl -G 'https://api.example.com' \ -d foo=bar \ -d baz=whee Is the same as curl 'https://api.example.com?foo=bar&baz=whee' That can make all the quoting hell a bit easier, as you're doing it one param at a time.
- zomglings 5y agoAssuming you pass your token in a header, put your token in an environment variable and add it to your request like this: ``` curl -H "Authorization: Bearer $TOKEN" ... ``` ??