Objects ConfigurationΒΆ

Getting started

Most of the actions available (about 95%) in the command line API (CLAPI) is available in the rest API.

Here is an example for listing business view using Rest API.

Using POST method and the URL below:

api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi

Header:

key

value

Content-Type

application/json

centreon-auth-token

the value of authToken you got on the authentication response

Body:

{
 "action":"show",
 "object":"bv"
}
  • The key action corresponds to the option -a in Centreon CLAPI, the value show corresponds to the -a option value.

  • The key object corresponds to the option -o in Centreon CLAPI, the value HOST corresponds to the -o option value.

The equivalent action using Centreon CLAPI is:

[root@centreon ~]# ./centreon -u $USER$ -p $PASS$ -o BV -a show

Response:

The response is a json flow listing all hosts and formated as below:

{
   "result": [
       {
           "id_ba_group": "1",
           "name": "BA-Mail-View",
           "description": "BA Mail View"
       },
       {
           "id_ba_group": "2",
           "name": "BA-CIO-View",
           "description": "BA CIO View"
       }
   ]
}

Note

Some actions need the values key ( the option -v in Centreon CLAPI ). Depending on the called action, the body can contain values key. We will see that in detail later.

Browse the CLAPI documentation to discover all add/update/delete actions possible on Centreon BAM objects.