Curl http request & access token

I need to make a http request with curl which also contains an access token (ex. Authorization: Bearer {{access_token}} ). Until now I haven’t found a way to do this.
Any suggestions?

Is easier to do it outside Asterisk using Shell or AGI and then simply apply a Python or PHP

1 Like

Every step of this (constructing the request, executing, error handling, parsing the response) will be easier in an AGI in a language you are comfortable.

The ‘P’ languages are the most popular. Personally, I use C. Choose a language that has an established AGI library.

1 Like

Can I parse a Json response with the “Shell” command?

Not directly. You can install a JSON processor like ‘jq’ but if your needs grow (and they almost always do), an AGI is much more featureful than ${SHELL()}.

You can use the JSON_DECODE function for this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.