HTTPie is AWESOME! if you're still using cURL do yourself a favor and get this https://httpie.org/
Here's a quick guide to make requests to the nexmo API that need to be authenticated with JWT and have a JSON request body.
You will need:
- The Nexmo CLI installed
- The private key for your application stored in a local file named
private.key
- The applicaiton ID of your applicaiton
- The payload of the request in a file called
request.json
(see example)
For exampe to create a call use the following command (replace the application ID with your value)
http POST https://api.nexmo.com/v1/calls Authorization: "Bearer `nexmo jwt:generate ./private.key application_id=aaaaaaaa-bbbb-cccc-dddd-0123456789ab`" @request.json
You'll get nicely formatted responses from the API