Page tree
Skip to end of metadata
Go to start of metadata

To install this module on your PBX 15.0 GUI please run: fwconsole ma install api


The API module allows administrators to configure and manage FreePBX remotely through automated. As an administrator you can use other languages to control your PBX systems.

When a company offers an API to their customers, it just means that they’ve built a set of dedicated URLs that return pure data responses — meaning the responses won’t contain the kind of presentational overhead that you would expect in a graphical user interface like a website.

Learn more about what an API is and what it can provide by watching this video:

API Types

Your PBX supports two API types: Restful and GraphQL.

A RESTful API – also referred to as a RESTful web service -- is based on representational state transfer (REST) technology, an architectural style and approach to communications often used in web services development.

GraphQL is an open source data query and manipulation language, and a runtime for fulfilling queries with existing data. GraphQL was developed internally by Facebook in 2012 before being publicly released in 2015. It provides a more efficient, powerful and flexible alternative to REST and ad-hoc web service architectures. It allows clients to define the structure of the data required, and exactly the same structure of the data is returned from the server, therefore preventing excessively large amounts of data from being returned.

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

Authentication

Authenticating with your PBX to utilize the API requires the use of oauth 2.0. Your PBX supports these specific oauth grants

  • Authorization code grant
  • Implicit grant
  • Resource owner credentials grant
  • Client credentials grant
  • Refresh token grant

To connect and utilize the API you will first need to create an "Application" in API Applications

Learn more about oatuth 2.0 here https://www.oauth.com/

Testing and Developing

A great client for testing RESTful APIs is Postman. You can grab a copy of postman here: https://www.getpostman.com/

A great client for testing GraphQL is Insomnia. You can grab a copy of Insomnia here: https://insomnia.rest/

Alternatively you can also check and test graphQL from directly inside of your PBX using the GraphQL Explorer and GraphQL Documentation tabs