How to use freepbx15 restapi ?


(Jack) #1

anyone can told me where can i find some example or how to document?
thank u ~~~


(Jack) #2

i have already get the token by postman.
i try to GET http://ipaddress/admin/api/api/rest:callwaiting:read
it’s responed

{
    "error": "ajaxRequest declined"
}

my step is :
1,create web-server app
2,open postman ,select auth type oauth2.0
3,input the secret code and client id
4,login use normal user account(can not login use administrator)
5,success get the access token
6,add token to headers
7,send the GET request


(Communication Technologies) #3

(Lorne Gaetz) #4

I know of no code examples, but there are many wiki pages starting here:
https://wiki.freepbx.org/display/FPG/API


(Jack) #5

do you know the url like http://ipaddress/admin/api/api/rest:callwaiting:read is correct?


(Dave Burgess) #6

Isn’t this module like two weeks old? Since it’s Open Source, there should be a Wiki for documenting this stuff, especially since it looks like, as it grows, it’s going to get more and more useful over time.


(Andrew Nagy) #8

While the API module for 15 exists there are no REST methods except one that tells the asterisk version (as an example). None of your calls will work unless you want to go code something yourself for the rest part. You are also calling them wrong as well but that doesn’t matter because it won’t work the way you want anyways.

The only parts that do work are graphql and only for adding extensions and viewing data from other modules. If said modules are supported.

The point of this module is to encourage the community to add functionality that is need or request functionality that is wanted. The reason work was not done “completely” is that there are over 128 modules. It would have taken years to get the work done.

The API module itself is a central holding place that all other modules link into. If you want user functionality for core in API under rest then you’ll need to go into the core module and add the code to process it. As it stands right now it doesn’t not exist.

It does for GraphQL however. But it is not tested there and may be harder for you to use.


(Jack) #9

thanks for your reply.
it is a long way to go.i would like to share my REST API when i finish it ,but it need some times:)