Anyone messed around with the API? Bad documentation

KNERD

Well-Known Member
Joined
Mar 9, 2014
Messages
2,133
Reaction score
836
I see the API is already installed on Incredible PBX 2021, but not on FreePBX.

I thought I would try to learn some things about it.

It seems the API has been out since version 13, but their documentation is atrocious, though has improved a bit in the past year, or so.

I found a page that caught my attention:


It was not what the page is about, but rather the example they are showing. It is showing how to get a summary of all the calls made on the PBX, and the total duration of the calls. I am interesting in this area of the API.

I would like to get a summary of the calls per month rather than all calls.

This is where the documentation is lacking.

I tried the example somewhat:


Screenshot from 2021-10-23 18-50-52.png

Notice it is using "allCrdrs" to retrieve the information. Their wiki is not even returning a search result for that.

So then I did the "Generate GraphQL Documentation based on scopes."

This what what it returns using the text "cdr."

Screenshot from 2021-10-23 18-51-55.png


It turns out that "cdr" is for POST, not GET.

Anyone know how else to get more info on the API on what I am trying to do?
 
Messing around with APIs can be both exciting and frustrating, especially when documentation is lacking. It's great that you've shared your experience with the Incredible PBX 2021 API and your efforts to learn more.
Speaking of APIs and software functionality, if you're looking for insights into functional testing, you might find ZAPTEST interesting. Functional testing tools can offer solutions for testing software APIs and ensuring they work as intended.
Keep up the exploration, and hopefully, you'll find the answers you're looking for regarding the API on FreePBX.
 
Last edited:
They have improved the documentation, but not by much.
 
Incredible PBX 2027 also has the API component: Connectivity -> API.

Using the GraphQL API Tool with Incredible PBX​


Begin by installing the required GraphQL components:

pip3 install --pre gql[all]

Next, open the FreePBX GUI and navigate to Connectivity -> API. Select the Scope Visualizer tab and check Read/Write for ALL GraphQL Modules. Then select the GraphQL Explorer tab and click Reload Explorer. In the GraphiQL dialog, enter the following and press the Start arrow to list all of your extensions:

query {
fetchAllExtensions {
status
message
totalCount
extension {
extensionId
}
}
}

For the complete tutorial on using GraphQL to list, edit, and populate virtually anything on your PBX, read this tutorial and review the Asterisk documentation for the GraphQL API.
 
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Back
Top