How do I make GraphQL API requests using fwconsole in FreePBX?

How do I make GraphQL API requests using fwconsole in FreePBX?


0

FreePBX has a GraphQL API which allows us to make requests such as the ones documented here.

I would like to use the fwconsole api command to make these API requests at the command line. There’s no documentation for how to do this – the only forum post I could find was someone asking exactly this question, and the post was closed automatically due to lack of responses.

I’ve tried things like

$ fwconsole api gql voicemail 'mutation { moduleOperations(input: { module: "voicemail", action: "enableVoiceMail", extensionId: "1081", password: "1234" }) { status message }}'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/usr/sbin/fwconsole ma mutation { moduleoperations(input: { module: "voicemail", action: "enablevoicemail", extensionid: "1081", password: "1234" }) { status message }} voicemail --'

and even-closer-to-their-api-docs:

$ fwconsole api gql voicemail 'mutation { enableVoiceMail(input: {extensionId: "1081", password: "1234" }) { status message }}'
sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/usr/sbin/fwconsole ma mutation { enablevoicemail(input: {extensionid: "1081", password: "1234" }) { status message }} voicemail --'

It looks like my output is being piped to the fwconsole ma subcommand somehow, though my attempts to trace through the code don’t indicate why this would be the case. Perhaps there’s simply no way to do this at the command line?

1

  • Just from taking a quick look at the source, this doesn't seem to do what you think it does. It is strictly for working with module administration, and likely for internal use only if it isn't documented anywhere. If you want to call API endpoints from CLI, the usual route is with curl or wget.

    – miken32

    35 mins ago


Load 6 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *