How to use freepbx15 restapi ?

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

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

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

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

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.

1 Like

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.

4 Likes

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:)

I had to look around and I found working rest functions on my freePBX for example:

/var/www/html/admin/modules/queues/Api/Rest/Queue.php

using the URL /admin/api/api/rest/queues/members

gave me the correct output!

3 Likes

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