What is an API for? Let’s find out all about it
This post is also available in : Spanish
What is an api for? Let’s see the necessary answers
So, when someone talks to you about APIs, do you still think it refers to Blas’ inseparable partner in Sesame Street? then you may have a little problem with technology. No one will ever mess with you again for this. But you must be careful. The explanation will be as educational and entertaining as those of the mythical Epi and Blas. Therefore, let’s answer this question: What is an api for?
What is an API for?
In order to explain what an API (Application Programming Interface) is for, we first need to know what it is. An API is a set of functions, procedures, and subroutines that provides a “library” for use by other software. Wait a minute, this is getting a little technical. What do we mean by all these words of expert specialists? Well, that an API is a set of actions that give us access to certain tasks of a software, such as tasks of creation, updating or deletion of elements.
What is an API for?
As we can see from their own description, APIs are used to make use of existing functions in other software. At the same time, different applications can make use of the APIs of each one to maintain a data communication between them, in a transparent way for the user.
An API is a way to give access to an application to an external user, where that user can only use and execute certain functions that the owner has given access to.
Let’s take a close example: the use of a game on your mobile. The game needs to collect information, such as name, phone number, etc. Instead of asking for all the information to be filled in manually, it asks for Facebook credentials and all the data is obtained using its API.
What is an API for? Pandora FMS API
Pandora FMS uses an external API to integrate third party applications in the use of the tool. This API is used by means of remote calls via HTTP over the file “api.php” included in “/var/www/html/pandora_console/include” (default path).
Like any other API you can find, there are some restrictions on its use. One of these restrictions is the different parameters that can be used in the call to the same, where you can highlight two major operations to perform, GET and SET, which will explain later.
There are also security restrictions regarding the use of the API. On the one hand, the administrator of the tool will have to configure three different sections for the use of the API by third parties. First, you will need to detail a list of IPs from which you can make use of the API. This restriction can be done by detailing a list of specific IPs or, on the contrary, by leaving access free from any possible IP. Second, you can optionally provide a password to use the API. Additionally, in order to access the API actions you must provide a valid username and password within the tool in which you want to use the API.
As mentioned above, there are two major operations to be performed using the API: GET and SET.
With GET operations, a list of data is requested which varies according to the call made. Inside Pandora FMS API you can request data about agents, modules, policies, graphs, events, alerts, groups, plugins, tags, server status… Inside Pandora FMS repertoire you can find more than 60 GET calls. An example of a GET API call might be how to get the list of agents from our machine:
Where we can see the operations “get” and “all_agents”, we want you to return it in csv format with the api password “1234” and the user “admin” with the password “pandora”.
With SET operations we can create, update or delete data. As in GET operations, actions can be carried out on agents, modules, policies… There are special cases where actions other than creation, modification or deletion can be carried out. In the case of policies, policies that have already been created can also be applied. Within Pandora FMS repertoire there are more than 100 SET type calls. An example of an API SET call could be how to remove an agent from our machine:
We can see the operations “set” and “delete_agent”, the agent that we want to remove “agent_erroneo” with the api password “1234” and the user “admin” with password “pandora”.
Link to the wiki in English:
By the way, if you’ve come this far and you’re interested in more things about technology and monitoring, what about Pandora?
Pandora FMS is a flexible monitoring system, capable of monitoring devices, infrastructures, applications, services and business processes.
Do you still want to know more about system monitoring? Luckily, you are in the right place to know more. In this blog there are dozens of articles that can introduce you to this exciting world. Here you have a link to our home page: https://blog.pandorafms.org/
Or you can also get to know Pandora FMS directly. Click here: https://pandorafms.com/
You can even send us any query you may have about Pandora FMS. You can do it in a very simple way, thanks to the contact form that can be found in the following address: https://pandorafms.com/contact/
El equipo de redacción de Pandora FMS está formado por un conjunto de escritores y profesionales de las TI con una cosa en común: su pasión por la monitorización de sistemas informáticos.
Pandora FMS’s editorial team is made up of a group of writers and IT professionals with one thing in common: their passion for computer system monitoring.