From 6a3358db2038582e4f8451ba7a2f72f4f5971d76 Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Tue, 17 Oct 2017 08:15:35 +0200 Subject: [PATCH] doc(api): improve api documentation (url) --- doc/en/api/api_rest/index.rst | 76 +++++++++++----------- doc/fr/api/api_rest/index.rst | 118 +++++++++++++++++----------------- 2 files changed, 97 insertions(+), 97 deletions(-) diff --git a/doc/en/api/api_rest/index.rst b/doc/en/api/api_rest/index.rst index de4166bacad..bc207d8df8e 100644 --- a/doc/en/api/api_rest/index.rst +++ b/doc/en/api/api_rest/index.rst @@ -7,7 +7,7 @@ API Rest Introduction ------------ -Welcome to the Centreon API rest documentation. This documentation is for devlopers familiar with HTTP requests and JSON. It explains various API operations, related request and response structure, and error codes. +Welcome to the Centreon API rest documentation. This documentation is for developers familiar with HTTP requests and JSON. It explains various API operations, related request and response structure, and error codes. If you are not familiar with the JSON API, we recommend you to use the Centreon command line API documentation. This documentation is available in english only. @@ -26,7 +26,7 @@ Authentication Using POST method and the URL below: :: - api.domain.tld/api/index.php?action=authenticate + api.domain.tld/centreon/api/index.php?action=authenticate Body form-data: @@ -60,7 +60,7 @@ All monitoring information regarding hosts are available in throw the Centreon A Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_hosts&action=list + api.domain.tld/centreon/api/index.php?object=centreon_realtime_hosts&action=list **Header:** @@ -166,7 +166,7 @@ Field list : Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_hosts&action=list&limit=60&viewType=all&sortType=name&order=desc&fields=id,name,alias,address,state,output,next_check + api.domain.tld/centreon/api/index.php?object=centreon_realtime_hosts&action=list&limit=60&viewType=all&sortType=name&order=desc&fields=id,name,alias,address,state,output,next_check Service Status -------------- @@ -175,7 +175,7 @@ All monitoring information regarding services are available in throw the Centreo Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_services&action=list + api.domain.tld/centreon/api/index.php?object=centreon_realtime_services&action=list **Header:** @@ -320,7 +320,7 @@ Example: Using GET method and the URL below: :: - api.domain.tld/api/index.php?action=list&object=centreon_realtime_services&limit=60&viewType=all&sortType=name&order=desc&fields=id,description,host_id,host_name,state,output + api.domain.tld/centreon/api/index.php?action=list&object=centreon_realtime_services&limit=60&viewType=all&sortType=name&order=desc&fields=id,description,host_id,host_name,state,output Configuration @@ -335,7 +335,7 @@ Here is an example for listing hosts using rest API. Using POST method and the URL below: :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header:** @@ -411,7 +411,7 @@ List hosts **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -472,7 +472,7 @@ Add host **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -510,7 +510,7 @@ Delete host **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -549,7 +549,7 @@ Set parameters **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -680,7 +680,7 @@ Set instance poller **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -718,7 +718,7 @@ Get macro **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -779,7 +779,7 @@ Set macro **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -817,7 +817,7 @@ Delete macro **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -855,7 +855,7 @@ Get template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -908,7 +908,7 @@ Set template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -946,7 +946,7 @@ Add template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -983,7 +983,7 @@ Delete template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1020,7 +1020,7 @@ Apply template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1056,7 +1056,7 @@ Get parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1098,7 +1098,7 @@ Add parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1140,7 +1140,7 @@ Set parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1183,7 +1183,7 @@ Delete parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1225,7 +1225,7 @@ Get contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1269,7 +1269,7 @@ Add contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1312,7 +1312,7 @@ Set contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1355,7 +1355,7 @@ Delete contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1396,7 +1396,7 @@ Get contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1438,7 +1438,7 @@ Add contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1481,7 +1481,7 @@ Set contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1525,7 +1525,7 @@ Delete contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1566,7 +1566,7 @@ Get hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1611,7 +1611,7 @@ Add hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1655,7 +1655,7 @@ Set hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1699,7 +1699,7 @@ Delete hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1750,7 +1750,7 @@ Enable **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1788,7 +1788,7 @@ Disable **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** diff --git a/doc/fr/api/api_rest/index.rst b/doc/fr/api/api_rest/index.rst index de4166bacad..400fd3f5a81 100644 --- a/doc/fr/api/api_rest/index.rst +++ b/doc/fr/api/api_rest/index.rst @@ -7,7 +7,7 @@ API Rest Introduction ------------ -Welcome to the Centreon API rest documentation. This documentation is for devlopers familiar with HTTP requests and JSON. It explains various API operations, related request and response structure, and error codes. +Welcome to the Centreon API rest documentation. This documentation is for developers familiar with HTTP requests and JSON. It explains various API operations, related request and response structure, and error codes. If you are not familiar with the JSON API, we recommend you to use the Centreon command line API documentation. This documentation is available in english only. @@ -26,7 +26,7 @@ Authentication Using POST method and the URL below: :: - api.domain.tld/api/index.php?action=authenticate + api.domain.tld/centreon/api/index.php?action=authenticate Body form-data: @@ -60,7 +60,7 @@ All monitoring information regarding hosts are available in throw the Centreon A Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_hosts&action=list + api.domain.tld/centreon/api/index.php?object=centreon_realtime_hosts&action=list **Header:** @@ -103,10 +103,10 @@ You can pass a list of parameters in order to select the data you want. +----------------+--------------------------------------------+ | number | page number | +----------------+--------------------------------------------+ -| order | the order type (selected in the field list)| +| order | the order type (selected in the field list)| +----------------+--------------------------------------------+ -Field list : +Field list : +--------------------------+------------------------------------------+ | Fields | Description | @@ -166,7 +166,7 @@ Field list : Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_hosts&action=list&limit=60&viewType=all&sortType=name&order=desc&fields=id,name,alias,address,state,output,next_check + api.domain.tld/centreon/api/index.php?object=centreon_realtime_hosts&action=list&limit=60&viewType=all&sortType=name&order=desc&fields=id,name,alias,address,state,output,next_check Service Status -------------- @@ -175,7 +175,7 @@ All monitoring information regarding services are available in throw the Centreo Using GET method and the URL below: :: - api.domain.tld/api/index.php?object=centreon_realtime_services&action=list + api.domain.tld/centreon/api/index.php?object=centreon_realtime_services&action=list **Header:** @@ -225,10 +225,10 @@ You can pass a list of parameters in order to select the data you want. +----------------+--------------------------------------------+ | number | page number | +----------------+--------------------------------------------+ -| order | the order type (selected in the field list)| +| order | the order type (selected in the field list)| +----------------+--------------------------------------------+ -Field list : +Field list : +--------------------------+------------------------------------------+ | Fields | Description | @@ -316,14 +316,14 @@ Field list : | criticality | criticality fo this service | +--------------------------+------------------------------------------± -Example: +Example: Using GET method and the URL below: :: - api.domain.tld/api/index.php?action=list&object=centreon_realtime_services&limit=60&viewType=all&sortType=name&order=desc&fields=id,description,host_id,host_name,state,output + api.domain.tld/centreon/api/index.php?action=list&object=centreon_realtime_services&limit=60&viewType=all&sortType=name&order=desc&fields=id,description,host_id,host_name,state,output -Configuration +Configuration ------------- Getting started @@ -335,7 +335,7 @@ Here is an example for listing hosts using rest API. Using POST method and the URL below: :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header:** @@ -354,7 +354,7 @@ Using POST method and the URL below: :: { "action": "show", "object": "HOST" - } + } * 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. @@ -362,7 +362,7 @@ Using POST method and the URL below: :: The equivalent action using Centreon CLAPI is: :: [root@centreon ~]# ./centreon -u admin -p centreon -o HOST -a show - + **Response:** The response is a json flow listing all hosts and formated as below: :: @@ -382,7 +382,7 @@ The response is a json flow listing all hosts and formated as below: :: "alias": "mail-neptune-frontend", "address": "mail-neptune-frontend", "activate": "1" - }, + }, { "id": "14", "name": "srvi-mysql01", @@ -411,7 +411,7 @@ List hosts **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -472,7 +472,7 @@ Add host **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -510,7 +510,7 @@ Delete host **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -549,7 +549,7 @@ Set parameters **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -680,7 +680,7 @@ Set instance poller **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -713,12 +713,12 @@ Set instance poller } -Get macro +Get macro ########## **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -744,7 +744,7 @@ Get macro -**Response** +**Response** Here is a response example :: { @@ -779,7 +779,7 @@ Set macro **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -806,7 +806,7 @@ Set macro To edit an existing custom marco, The MacroName used on the body should be defined on the Custom Marco of the choosen host. If the marco doesn't exist, it will be created. **Response** :: - + { "result": [] } @@ -817,7 +817,7 @@ Delete macro **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -841,7 +841,7 @@ Delete macro "values": "mail-uranus-frontend;MacroName" } -The MacroName used on the body is the macro to delete. It should be defined on the Custom Marco of the choosen host. +The MacroName used on the body is the macro to delete. It should be defined on the Custom Marco of the choosen host. **Response** :: @@ -855,7 +855,7 @@ Get template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -883,7 +883,7 @@ Get template **Response** Here is a response example :: - + { "result": [ { @@ -908,7 +908,7 @@ Set template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -937,7 +937,7 @@ The MyHostTemplate used on the body should exist as a host template. The new tem **Response** :: { "result": [] - } + } @@ -946,7 +946,7 @@ Add template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -970,7 +970,7 @@ Add template "values": "mail-uranus-frontend;MyHostTemplate" } -The MyHostTemplate used on the body should exist as a host template. The new template is added without erasing template already linked +The MyHostTemplate used on the body should exist as a host template. The new template is added without erasing template already linked **Response** :: { @@ -983,7 +983,7 @@ Delete template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1007,7 +1007,7 @@ Delete template "values": "mail-uranus-frontend;MyHostTemplate" } -The MyHostTemplate used on the body should exist as a host template. +The MyHostTemplate used on the body should exist as a host template. **Response** :: { @@ -1020,7 +1020,7 @@ Apply template **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1056,7 +1056,7 @@ Get parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1082,7 +1082,7 @@ Get parent **Response** :: - + { "result": [ { @@ -1091,14 +1091,14 @@ Get parent } ] } - + Add parent ########## **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1140,7 +1140,7 @@ Set parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1183,7 +1183,7 @@ Delete parent **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1225,7 +1225,7 @@ Get contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1260,7 +1260,7 @@ Get contact group } ] } - + @@ -1269,7 +1269,7 @@ Add contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1312,7 +1312,7 @@ Set contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1355,7 +1355,7 @@ Delete contact group **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1396,7 +1396,7 @@ Get contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1430,7 +1430,7 @@ Get contact "name": "user-mail" } ] - } + } Add contact @@ -1438,7 +1438,7 @@ Add contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1481,7 +1481,7 @@ Set contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1525,7 +1525,7 @@ Delete contact **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1566,7 +1566,7 @@ Get hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1611,7 +1611,7 @@ Add hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1655,7 +1655,7 @@ Set hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1699,7 +1699,7 @@ Delete hostgroup **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1750,7 +1750,7 @@ Enable **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header** @@ -1788,7 +1788,7 @@ Disable **POST** :: - api.domain.tld/api/index.php?action=action&object=centreon_clapi + api.domain.tld/centreon/api/index.php?action=action&object=centreon_clapi **Header**