want ability to make raw api calls
What problem are you facing?
I want to be able to perform actions that don't yet have high level subcommands
How could the Equinix Metal CLI help solve this problem?
Allow me to pass arbitrary API calls on the command line.
e.g., the following would be equivalent:
packet project get -i {id} -j
packet api /projects/{id}
Additionally, I'd like to be able to specify the request method (e.g., like curl -X POST) and request data (e.g., like curl -d '{"someJson":true}).
For GET and DELETE requests this is fairly straightforward.
For POST, PUT, PATCH request types we would likely eschew endpoint specific options for a raw body field, as you suggest.
Perhaps the command's naming convention could fit more closely with the existing commands as:
packet raw create, packet raw get, etc. And perhaps raw is as descriptive as api.
Our table output format is not prepared for arbitrary field results, so may have to require json or yaml output modes in this case.
As the requestor, I'd be fine with having raw api calls always return json. I.e., -j is always implied.
I'm also interested in being able to call endpoints that have not yet been implemented in the cli client. Being able to pass an explicit query string would allow me to do that.
@bahamat until that's done in packet-cli, checkout https://github.com/t0mk/packetjq you can even process the JSON with jq like expressions
Nice, I was just thinking I'd like to see this too. I really like how the gh cli has this escape hatch. Its also nice that there's an easy to use arg to handle pagination and I'd like to see it in metal too.
My vote is for metal api like gh, feels right.