clever-tools
clever-tools copied to clipboard
Add a `sign` command to generate oauth signatures
When manually interacting with the API via curl, generating signatures is a bit of a chore.
I needed to interact with the backup API earlier and ended up using @clevercloud/client
from the node REPL to generate signatures. Having a command for that could make custom api calls way easier (be it to explore the API or issue custom calls not supported by the CLI).
One possible way would be to only output the authorization header contents, another would be generate a curl command ready to be copied. Issuing the HTTP call directly would be to tedious to implement on the arguments parsing side.
$ clever sign <METHOD> <URL> [<params>]
Authorization: xxx
# or
$ clever sign <METHOD> <URL> [<params>]
curl '<URL>' -X '<METHOD>' -H 'Authorization: xxx'
I think that would make interacting directly with the APi way easier
(if you find it interesting, i can handle the implementation, i've tried a PoC here: https://github.com/CleverCloud/clever-tools/compare/master...divarvel:sign-command)
This is a limitation from cURL, sadly.
Have you considered using a GUI like Postman? I know this doesn't address your CLI usage with cURL but it works great with oAuth v1 and our API.
You setup the 4 oauth strings once and your done for all the other API fiddling/interacting you'll need to do...
Well, i mostly use curl from scripts. That would make scripts easier to write, by reusing clever-tools
when needed, instead of having to roll out a whole new executable.
This is a limitation from cURL, sadly.
Have you considered using a GUI like Postman? I know this doesn't address your CLI usage with cURL but it works great with oAuth v1 and our API.
My (main) usage of the clever tools is made by a machine (I only use the clever tools as a human to debug things around) so this command would be very useful in a continuous deployment environment.
Fixed with clever curl
!