Since GLPI version 9.1 a REST API is available to extend functionalities and enable integrations with third-party solutions.
You will learn how to set it up in these tutorial.
Currently, you can use GLPI REST API with two of our developments:
- GLPI Reminders: First Google Chrome & Mozilla Firefox extension for GLPI
- Gapp Self-Service: A GLPI app. (Android 6+)
You need at least 3 steps
Enable Rest API
First, head to: Setup > General > API
There are 4 main settings there:
- URL of the API is one of the most important parameters you will need to setup your application. You won’t need to change it.
- Now, Enable REST API by setting the dropdown to YES.
- Then you have to choose if you’re going to use user credentials, a token or both of them (as in the screenshot above). Enable the ones you need and save the changes.
Add an API Client
By default, GLPI API is only allowed to be accessed from the same server.
We need to create at least an API client to grant our clients, access to it. So, let’s go back to our previous, API setup page, and click on the Add API Client button.
On this form, you can Enable multiple API Clients, just:
- Add a descriptive name
- Set active to YES.
- It’s not compulsory, but you should log every connection. You can choose between enabling log connections onto the GLPI log, or on a log file.
- Finally, you can filter access by IP.
- Save and you’re good to go unless the app you’re using supports application token, in which case you will need to regenerate it and add it to the app setup. This is an optional extra security layer.
User API Token
If your app needs it, as for our GLPI Reminders browser extension, one last step needs to be performed in order to get it working.
Go to your user profile (each user has to perform this step), and on the lower section Remote access keys, click on Regenerate and save.
Afterwards, you will have a new API token. You can copy it by clicking on the copy icon on the right. Then paste it on your software configuration.
If using GLPI Reminders, will look like this.
And that’s it!