Please copy your secret as you will not be able to retrieve it later
Client Secret :46cd058cf8be20431eda700a4be2cb93
I’d like to get token to show rest methods.
POSTMAN
POST request
url/admin/api/api/token
BODY
x-www-form-unlencoded
grant_type=authorization_code??? not sure how to get grant type here(password or code)
client_id=8053a9cdec3370652d9673ee71396934be5e95706b24e700d4c0a834c7b53ec1
client_secret=46cd058cf8be20431eda700a4be2cb93
okay. I’ve created Machine to Machine app and used grant_type=client_credentials. For now I’ve get tocken. How can I get list of API methods?
url/admin/api/api/rest
result
Page Not Found
I’ve tried follows
GET url/admin/api/api/rest/users
TYPE Bearer token: token
response:
Page Not Found
The page you are looking for could not be found. Check the address bar to ensure your URL is spelled correctly. If all else fails, you can visit our home page at the link below.
From experience these are the types of replies that exhaust and frustrate long time community members and make them “pissy” or “mean”.
Please make sure you read all replies to a thread you are participating in because one of the replies might just pertain to you and even answer your question.
Also take into account that I’m not mad or upset. I’m just trying to help you to stop wasting your valuable time on something that doesn’t exist and so it will never work.
Your PBX supports two API types: Restful and GraphQL .
and
Most, if not all, PBX modules have been written to use GraphQL, however any module can also be extended to use standard Restful calls as well
So while there are no existing RESTful methods in the API as it stands, it can be extended to do so and there is nothing in the documents I see so far that covers how to do such extensions to the API for RESTful calls.
To me this means people will look at see that it supports RESTful but only to discover that when they go to use it, no RESTful methods are configured to be used and there is nothing to show how to do such methods.
This then all goes back to the question of “How does one configure the supported RESTful method to use it?”.
I’ve already tried that way. Unfortunately have error
{
“status”: false,
“message”: “unauthorized”
}
GET url
url/admin/api/api/rest/framework/version
token was received, but something strange with scopes
select scopes from api_access_tokens where token = ‘token’;
±-------+
| scopes |
±-------+
| [] |
although
You have to request scopes from the client side for them to show up in “api_access_tokens”. You’ve requested zero scopes from your client, therefore you get “unauthorized”.
“scope (optional)”
I suggest you do some reading on how OAuth 2.0 works. After looking over the code there are two rest methods: framework version and core user information (basically half of an extension).
What do you want to do with those? Do you intend to build more rest calls into FreePBX? or are you looking for something that perhaps doesn’t exist?
Thank you. Finally I’ve got first response from REST FreePBX API with version. My main idea is avoid communicate with FreePBX directly.First step I’d like to add extensions and trunks via Rest API. For now as I’ve already understood there are no methods that allow add trunks and extensions, but I can write them by myself using internal FreePBX methods. Like getVersion(). etc. And that methods I can find from sources. Am I right?