diff --git a/doc/en/api/clapi/objects/realtime_downtimes.rst b/doc/en/api/clapi/objects/realtime_downtimes.rst index 1ccb5446963..de85d687713 100644 --- a/doc/en/api/clapi/objects/realtime_downtimes.rst +++ b/doc/en/api/clapi/objects/realtime_downtimes.rst @@ -14,14 +14,16 @@ In order to list available real time downtimes, use the **SHOW** action:: You can use the value "HOST" to display all the downtimes:: [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a show -v "HOST;generic-host" - host_name;author;actual_start_time;actual_end_time;start_time;end_time;comment_data;duration;fixed - generic-host;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 + id;host_name;author;actual_start_time;actual_end_time;start_time;end_time;comment_data;duration;fixed + 6;generic-host;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 Columns are the following : ================================= =========================================================================== Column Description ================================= =========================================================================== +id Name of the downtime + Host_name Name of the host Author Name of the author @@ -49,14 +51,16 @@ In order to list available real time downtimes, use the **SHOW** action:: You can use the value "SVC" to display all the downtimes:: [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a show -v "SVC;generic-host,generic-service" - host_name;service_name;author;start_time;end_time;comment_data;duration;fixed - generic-host;generic-service;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 + id;host_name;service_name;author;start_time;end_time;comment_data;duration;fixed + 42;generic-host;generic-service;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 Columns are the following : ================================= =========================================================================== Column Description ================================= =========================================================================== +id Name of the downtime + Host_name Name of the host Service_name Name of the service @@ -170,3 +174,21 @@ Order Description 7 Short description of the real time downtime ========= ============================================ + + +Cancel a real time downtime +------------------------------ + +In order to cancel a real time downtime, use the **CANCEL** action:: +To get the value of the id, use the **SHOW** action:: + + [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a CANCEL -v "6|42" + +The required parameters are the following : + +========= ============================================ +Order Description +========= ============================================ +1 Id of downtime + +========= ============================================ diff --git a/doc/fr/api/clapi/objects/realtime_downtimes.rst b/doc/fr/api/clapi/objects/realtime_downtimes.rst index 1ccb5446963..de85d687713 100644 --- a/doc/fr/api/clapi/objects/realtime_downtimes.rst +++ b/doc/fr/api/clapi/objects/realtime_downtimes.rst @@ -14,14 +14,16 @@ In order to list available real time downtimes, use the **SHOW** action:: You can use the value "HOST" to display all the downtimes:: [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a show -v "HOST;generic-host" - host_name;author;actual_start_time;actual_end_time;start_time;end_time;comment_data;duration;fixed - generic-host;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 + id;host_name;author;actual_start_time;actual_end_time;start_time;end_time;comment_data;duration;fixed + 6;generic-host;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 Columns are the following : ================================= =========================================================================== Column Description ================================= =========================================================================== +id Name of the downtime + Host_name Name of the host Author Name of the author @@ -49,14 +51,16 @@ In order to list available real time downtimes, use the **SHOW** action:: You can use the value "SVC" to display all the downtimes:: [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a show -v "SVC;generic-host,generic-service" - host_name;service_name;author;start_time;end_time;comment_data;duration;fixed - generic-host;generic-service;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 + id;host_name;service_name;author;start_time;end_time;comment_data;duration;fixed + 42;generic-host;generic-service;admin;2017/09/28 14:21;N/A;2017/09/26 17:00;2017/09/30 19:00;'generic-comment';3600;1 Columns are the following : ================================= =========================================================================== Column Description ================================= =========================================================================== +id Name of the downtime + Host_name Name of the host Service_name Name of the service @@ -170,3 +174,21 @@ Order Description 7 Short description of the real time downtime ========= ============================================ + + +Cancel a real time downtime +------------------------------ + +In order to cancel a real time downtime, use the **CANCEL** action:: +To get the value of the id, use the **SHOW** action:: + + [root@centreon ~]# ./centreon -u admin -p centreon -o RTDOWNTIME -a CANCEL -v "6|42" + +The required parameters are the following : + +========= ============================================ +Order Description +========= ============================================ +1 Id of downtime + +========= ============================================ diff --git a/lib/Centreon/Object/Downtime/RtDowntime.php b/lib/Centreon/Object/Downtime/RtDowntime.php index f9115423de8..23370a4d736 100644 --- a/lib/Centreon/Object/Downtime/RtDowntime.php +++ b/lib/Centreon/Object/Downtime/RtDowntime.php @@ -47,6 +47,12 @@ class Centreon_Object_RtDowntime extends Centreon_ObjectRt protected $primaryKey = "downtime_id"; protected $uniqueLabelField = "comment_data"; + public function __construct() + { + parent::__construct(); + $this->db = Centreon_Db_Manager::factory('storage'); + } + /** * @param array $hostList * @return array @@ -59,14 +65,16 @@ public function getHostDowntimes($hostList = array()) $hostFilter = "AND h.name IN ('" . implode("','", $hostList) . "') "; } - $query = "SELECT name, author, actual_start_time , end_time, comment_data, duration, fixed " . + $query = "SELECT internal_id, name, author, actual_start_time , actual_end_time, " . + "start_time, end_time, comment_data, duration, fixed " . "FROM downtimes d, hosts h " . "WHERE d.host_id = h.host_id " . "AND d.cancelled = 0 " . - "AND d.actual_end_time IS NULL " . "AND service_id IS NULL " . + "AND end_time > UNIX_TIMESTAMP(NOW()) " . + "AND start_time < UNIX_TIMESTAMP(NOW()) " . $hostFilter . - "ORDER BY actual_start_time"; + "ORDER BY actual_start_time, name"; return $this->getResult($query); } @@ -90,16 +98,29 @@ public function getSvcDowntimes($svcList = array()) $serviceFilter .= implode(' AND ', $filterTab) . ') '; } - $query = "SELECT h.name, s.description, author, actual_start_time , end_time, comment_data, duration, fixed " . + $query = "SELECT d.internal_id, h.name, s.description, author, actual_start_time, actual_end_time, " . + "start_time, end_time, comment_data, duration, fixed " . "FROM downtimes d, hosts h, services s " . "WHERE d.service_id = s.service_id " . "AND d.host_id = s.host_id " . "AND s.host_id = h.host_id " . "AND d.cancelled = 0 " . + "AND end_time > UNIX_TIMESTAMP(NOW()) " . + "AND start_time < UNIX_TIMESTAMP(NOW()) " . $serviceFilter . - "AND d.actual_end_time IS NULL " . - "ORDER BY actual_start_time"; + "ORDER BY actual_start_time, h.name, s.description"; return $this->getResult($query); } + + /** + * @param $id + * @return array + */ + public function getCurrentDowntime($id) + { + $query = "SELECT * FROM downtimes WHERE ISNULL(actual_end_time) " . + " AND end_time > " . time() . " AND internal_id = " . $id; + return $this->getResult($query, array(), 'fetch'); + } } diff --git a/tests/rest_api/realtime_rest_api.postman_collection.json b/tests/rest_api/realtime_rest_api.postman_collection.json index 16589e35139..3cd537bc0ef 100644 --- a/tests/rest_api/realtime_rest_api.postman_collection.json +++ b/tests/rest_api/realtime_rest_api.postman_collection.json @@ -1,6251 +1,6257 @@ { - "variables": [], - "info": { - "name": "Centreon Web Rest API realtime", - "_postman_id": "a3390387-9951-1ff9-b164-5ac10459ac21", - "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" - }, - "item": [ - { - "name": "00-Authenticate", - "item": [ - { - "name": "Authenticate", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var jsonData = JSON.parse(responseBody);", - "postman.setEnvironmentVariable(\"token\",jsonData.authToken);", - "", - "postman.setGlobalVariable(\"loadHelpers\", function loadHelpers() {", - " \"use strict\";", - " let helpers = {};", - "", - " /** Test function to show this kludge is working. */", - " helpers.test200 = function test200() {", - " tests[\"Response returned 200\"] = responseCode.code === 200;", - " }", - " ", - " helpers.testJson = function testJson() {", - " tests[\"Content-Type header is application/json\"] = postman.getResponseHeader(\"Content-Type\") === 'application/json';", - " ", - " let result;", - " try {", - " JSON.parse(responseBody);", - " } catch (e) {", - " result = false;", - " }", - " result = true;", - " ", - " tests[\"Response body uses json format\"] = result;", - " }", - " ", - " helpers.notEmpty = function notEmpty() {", - " tests[\"Result is not empty\"] = JSON.parse(responseBody).length > 0;", - " }", - " ", - " helpers.checkHostListFormat = function checkHostListFormat(columns) {", - " if (typeof columns === 'undefined') {", - " columns = [\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"criticality\"];", - " }", - " ", - " let hostListSchema = {", - " \"$schema\": \"http://json-schema.org/draft-04/schema#\",", - " \"type\": \"array\",", - " \"items\": {\t\t", - " \"type\": \"object\",", - " \"required\": columns,", - " \"properties\": {", - " \"id\": { \"type\": \"string\" },", - " \"name\": { \"type \": \"string\" },", - " \"alias\": { \"type \": \"string\" },", - " \"address\": { \"type\": \"string\" },", - " \"state\": { \"type\": \"string\" },", - " \"state_type\": { \"type \": \"string\" },", - " \"output\": { \"type \": \"string\" },", - " \"max_check_attempts\": { \"type\": \"string\" },", - " \"check_attempt\": { \"type\": \"string\" },", - " \"last_check\": { \"type\": [\"string\", \"null\"] },", - " \"last_state_change\": { \"type\": [\"string\", \"null\"] },", - " \"last_hard_state_change\": { \"type\": [\"string\", \"null\"] },", - " \"acknowledged\": { \"type \": \"string\" },", - " \"instance_name\": { \"type \": \"string\" },", - " \"criticality\": { \"type\": [\"string\", \"null\"] }", - " },", - " \"additionalProperties\": true", - " }", - " };", - " tests[\"host list is well formated\"] = tv4.validate(JSON.parse(responseBody), hostListSchema);", - " }", - " ", - " helpers.checkServiceListFormat = function checkServiceListFormat(columns) {", - " if (typeof columns === 'undefined') {", - " columns = [\"host_id\", \"name\", \"description\", \"service_id\", \"state\", \"state_type\", \"output\", \"perfdata\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"criticality\"];", - " }", - " ", - " let serviceListSchema = {", - " \"$schema\": \"http://json-schema.org/draft-04/schema#\",", - " \"type\": \"array\",", - " \"items\": {\t\t", - " \"type\": \"object\",", - " \"required\": columns,", - " \"properties\": {", - " \"host_id\": { \"type\": \"string\" },", - " \"name\": { \"type \": \"string\" },", - " \"description\": { \"type \": \"string\" },", - " \"service_id\": { \"type\": \"string\" },", - " \"state\": { \"type\": \"string\" },", - " \"state_type\": { \"type \": \"string\" },", - " \"output\": { \"type \": \"string\" },", - " \"perfdata\": { \"type \": \"string\" },", - " \"max_check_attempts\": { \"type\": \"string\" },", - " \"check_attempt\": { \"type\": \"string\" },", - " \"last_check\": { \"type\": [\"string\", \"null\"] },", - " \"last_state_change\": { \"type\": [\"string\", \"null\"] },", - " \"last_hard_state_change\": { \"type\": [\"string\", \"null\"] },", - " \"acknowledged\": { \"type \": \"string\" },", - " \"criticality\": { \"type\": [\"string\", \"null\"] }", - " },", - " \"additionalProperties\": true", - " }", - " };", - " tests[\"service list is well formated\"] = tv4.validate(JSON.parse(responseBody), serviceListSchema);", - " }", - " ", - " helpers.checkHostList = function checkHostList(columns) {", - " helpers.test200();", - " helpers.testJson();", - " helpers.notEmpty();", - " helpers.checkHostListFormat(columns);", - " }", - " ", - " helpers.checkServiceList = function checkServiceList(columns) {", - " helpers.test200();", - " helpers.testJson();", - " helpers.notEmpty();", - " helpers.checkServiceListFormat(columns);", - " }", - "", - " return helpers;", - "} + '; loadHelpers();'); // when eval'd out of globals, execute it", - "tests[\"helpers initialized\"] = true;", - "" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/x-www-form-urlencoded" - } - ], - "body": { - "mode": "urlencoded", - "urlencoded": [ - { - "key": "username", - "value": "{{api_user}}", - "type": "text" - }, - { - "key": "password", - "value": "{{api_password}}", - "type": "text" - } - ] - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=authenticate", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "authenticate", - "equals": true - } - ] - } - }, - "response": [] - } - ] - }, - { - "name": "01-Base configuration", - "item": [ - { - "name": "10-Timeperiods", - "item": [ - { - "name": "Add tp", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"tp\",\n \"values\": \"{{tp_name}};{{tp_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam sunday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};sunday;{{tp_sunday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam monday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};monday;{{tp_monday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam tuesday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};tuesday;{{tp_tuesday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam wednesday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};wednesday;{{tp_wednesday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam thursday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};thursday;{{tp_thursday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam friday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};friday;{{tp_friday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam saturday", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};saturday;{{tp_saturday}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "11-Commands", - "description": "Tests all commands to manage commands.", - "item": [ - { - "name": "Add command", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"cmd\",\n \"values\": \"{{command_name}};{{command_type}};{{command_line}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "21-Contacts", - "description": "Tests all commands to manage contact.", - "item": [ - { - "name": "Add contact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"contact\",\n \"values\": \"{{contact_name}};{{contact_alias}};test@localhost;{{contact_pwd}};0;0;en_US;Idap\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam hostnotifcmd", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifcmd;{{command_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam svcnotifcmd", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};svcnotifcmd;{{command_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam hostnotifperiod", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifperiod;{{tp_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam svcnotifperiod", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};svcnotifperiod;{{tp_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam hostnotifopt", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifopt;{{contact_hostnotifopt}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam svcnotifopt", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};servicenotifopt;{{contact_svcnotifopt}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "22-Contactgroups", - "description": "Tests all commands to manage contact groups.", - "item": [ - { - "name": "Add contact group", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"cg\",\n \"values\": \"{{cg_name}};{{cg_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addcontact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"addcontact\",\n \"object\": \"cg\",\n \"values\": \"{{cg_name}};{{contact_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "23-Hostgroups", - "description": "Tests all commands to manage host groups.", - "item": [ - { - "name": "Add hostgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"hg\",\n \"values\": \"{{hg_name}};{{hg_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "24-Hosts_Categories", - "description": "Tests all commands to manage host categories.", - "item": [ - { - "name": "Add host category", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"hc\",\n \"values\": \"{{hc_name}};{{hc_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Set hc severity", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"hc\",\n \"values\": \"{{hc_name}};{{hc_severity_level}};{{hc_severity_icon}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "25-Services_Categories", - "description": "Tests all commands to manage service categories.", - "item": [ - { - "name": "Add service category", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"sc\",\n \"values\": \"{{sc_name}};{{sc_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Set sc severity", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"sc\",\n \"values\": \"{{sc_name}};{{sc_severity_level}};{{sc_severity_image}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "26-Servicegroups", - "description": "Tests all commands to manage service groups.", - "item": [ - { - "name": "Add service group", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"sg\",\n \"values\": \"{{sg_name}};{{sg_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "30-Hosts_Templates", - "item": [ - { - "name": "Create host template", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{htpl_name}};{{host_address}};;central;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam check_command", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};check_command;{{command_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam check_period", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};check_period;{{tp_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam max_check_attempts", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};max_check_attempts;{{host_max_check_attempts}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "equals": true, - "key": "action", - "value": "action" - }, - { - "equals": true, - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam snmp_community", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};snmp_community;{{host_snmp_community}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "equals": true, - "key": "action", - "value": "action" - }, - { - "equals": true, - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam snmp_version", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};snmp_version;{{host_snmp_version}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "equals": true, - "key": "action", - "value": "action" - }, - { - "equals": true, - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Addcontactgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"addcontactgroup\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{cg_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{contact_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setseverity", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{hc_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "31-Hosts", - "description": "Tests all commands to manage hosts", - "item": [ - { - "name": "Add host", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{host_alias}};{{host_address}};{{htpl_name}};Central;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam check_command", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"setparam\",\n \"object\":\"host\",\n \"values\": \"{{host_name}};check_command;{{command_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addtemplate", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"addtemplate\",\n \"object\":\"host\",\n \"values\": \"{{host_name}};{{htpl_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Applytpl", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\":\"applytpl\",\n \"object\":\"host\",\n \"values\": \"{{host_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontactgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{cg_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{contact_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Sethostgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"sethostgroup\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{hg_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setseverity", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{hc_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Add host 2", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"host\",\n \"values\": \"{{host_name2}};{{host_alias}};0.0.0.0;{{htpl_name}};Central;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "40-Services_Templates", - "description": "Tests all commands to manage service templates.", - "item": [ - { - "name": "Add service template", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{stpl_alias}};\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam check_period", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};check_period;{{tp_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam check_command", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};check_command;{{command_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam max_check_attempts", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};max_check_attempts;{{stpl_max_check}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action" - }, - { - "key": "object", - "value": "centreon_clapi" - } - ] - } - }, - "response": [] - }, - { - "name": "Sethosttemplate", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"sethosttemplate\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{htpl_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{contact_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontactgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{cg_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "41-Services", - "description": "Tests all commands to manage services.", - "item": [ - { - "name": "Add service", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{stpl_description}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setparam template", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setparam\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};template;{{stpl_description}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setseverity", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{sc_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontact", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{contact_alias}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Setcontactgroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{cg_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Set servicegroup", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"setservice\",\n \"object\": \"sg\",\n \"values\": \"{{sg_name}};{{host_name}},{{service_description}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "99-Generate", - "item": [ - { - "name": "Generate configuration", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "", - "function wait(millis) {", - " var date = new Date();", - " var curDate = null;", - " do { curDate = new Date(); }", - " while(curDate-date < millis);", - "}", - "", - "wait(2000);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"APPLYCFG\",\n \"values\": \"Central\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - } - ] - }, - { - "name": "10-Host", - "item": [ - { - "name": "host list without parameters", - "item": [ - { - "name": "host list", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Host list with limit parameter", - "item": [ - { - "name": "Limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Limit with field name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList([\"name\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit=2&fields=name", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "2", - "equals": true - }, - { - "key": "fields", - "value": "name", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Limit with all fields", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList([\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"next_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"instance_id\", \"criticality\", \"passive_checks\", \"active_checks\", \"notify\", \"action_url\", \"notes_url\", \"notes\", \"icon_image\", \"icon_image_alt\", \"scheduled_downtime_depth\", \"flapping\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit=2&fields=id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "2", - "equals": true - }, - { - "key": "fields", - "value": "id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Host list with viewType parameter", - "item": [ - { - "name": "list with viewType", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=all,unhandled,problems", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "viewType", - "value": "all,unhandled,problems", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "with viewType all", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=all", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "viewType", - "value": "all", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "with viewType unhandled", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=unhandled", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "viewType", - "value": "unhandled", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "with viewType problems", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=problems", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "viewType", - "value": "problems", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "viewType with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=all,unhandled,problems", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "viewType", - "value": "all,unhandled,problems", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "viewType all with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=all", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "viewType", - "value": "all", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "viewType unhandled with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=unhandled", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "viewType", - "value": "unhandled", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "viewType problems with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=problems", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "viewType", - "value": "problems", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Host list with status filter", - "item": [ - { - "name": "status up with state and name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=up&fields=name, state", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "status", - "value": "up", - "equals": true - }, - { - "key": "fields", - "value": "name, state", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "status down with state and name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=down&fields=name, state", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "status", - "value": "down", - "equals": true - }, - { - "key": "fields", - "value": "name, state", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "status unreachable with state and name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=unreachable&fields=name, state", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "status", - "value": "unreachable", - "equals": true - }, - { - "key": "fields", - "value": "name, state", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "status pending with state and name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=pending&fields=name, state", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "status", - "value": "pending", - "equals": true - }, - { - "key": "fields", - "value": "name, state", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "status all with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList([\"name\", \"state\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&status=all&fields=name, state", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "status", - "value": "all", - "equals": true - }, - { - "key": "fields", - "value": "name, state", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Host list by Host", - "item": [ - { - "name": "search by host name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with status up", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=up", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "status", - "value": "up", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with status down", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=down", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "status", - "value": "down", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with status pending", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=pending", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "status", - "value": "pending", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with status unreachable", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=unreachable", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "status", - "value": "unreachable", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with id field", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList([\"id\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&fields=id", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "fields", - "value": "id", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "search by host name with all fields", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkHostList([\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"next_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"instance_id\", \"criticality\", \"passive_checks\", \"active_checks\", \"notify\", \"action_url\", \"notes_url\", \"notes\", \"icon_image\", \"icon_image_alt\", \"scheduled_downtime_depth\", \"flapping\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&fields=id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_hosts", - "equals": true - }, - { - "key": "search", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "fields", - "value": "id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - } - ] - }, - { - "name": "20-Service", - "item": [ - { - "name": "Service list without parameters", - "item": [ - { - "name": "Service List", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Service list by host and service", - "item": [ - { - "name": "Service List by host name", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "searchHost", - "value": "{{host_name}}", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Service List by service description", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}&searchService={{service_description}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "searchHost", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "searchService", - "value": "{{service_description}}", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Service List by host name and service description", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}&searchService={{service_description}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "searchHost", - "value": "{{host_name}}", - "equals": true - }, - { - "key": "searchService", - "value": "{{service_description}}", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Service list with limit parameter", - "item": [ - { - "name": "Service List with limit", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Service List with limit and one field", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList([\"service_id\"]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}&fields=id", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "fields", - "value": "id", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Service List with limit and all fields", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.checkServiceList([", - " \"host_id\",", - " \"host_name\",", - " \"host_alias\",", - " \"host_address\",", - " \"host_state\",", - " \"host_state_type\",", - " \"host_output\",", - " \"host_last_check\",", - " \"host_next_check\",", - " \"host_acknowledged\",", - " \"instance_name\",", - " \"instance_id\",", - " \"host_action_url\",", - " \"host_notes_url\",", - " \"host_icon_image\",", - " \"description\",", - " \"state\",", - " \"state_type\",", - " \"service_id\",", - " \"output\",", - " \"perfdata\",", - " \"current_attempt\",", - " \"last_update\",", - " \"last_state_change\",", - " \"last_hard_state_change\",", - " \"last_check\",", - " \"next_check\",", - " \"max_check_attempts\",", - " \"notes\",", - " \"notes_url\",", - " \"action_url\",", - " \"icon_image\",", - " \"display_name\",", - " \"notify\",", - " \"acknowledged\",", - " \"passive_checks\",", - " \"active_checks\",", - " \"event_handler_enabled\",", - " \"flapping\",", - " \"scheduled_downtime_depth\",", - " \"flap_detection\",", - " \"criticality\"", - " ]);" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}&fields=host_id,host_name,host_alias,host_address,host_state,host_state_type,host_output,host_last_check,host_next_check,host_acknowledged,instance,instance_id,host_action_url,host_notes_url,host_icon_image,description,state,state_type,id,output,perfdata,current_attempt,last_update,last_state_change,last_hard_state_change,last_check,next_check,max_check_attempts,notes,notes_url,action_url,icon_image,display_name,notify,acknowledged,passive_checks,active_checks,event_handler_enabled,flapping,scheduled_downtime_depth,flap_detection,criticality", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "limit", - "value": "{{my_limit}}", - "equals": true - }, - { - "key": "fields", - "value": "host_id,host_name,host_alias,host_address,host_state,host_state_type,host_output,host_last_check,host_next_check,host_acknowledged,instance,instance_id,host_action_url,host_notes_url,host_icon_image,description,state,state_type,id,output,perfdata,current_attempt,last_update,last_state_change,last_hard_state_change,last_check,next_check,max_check_attempts,notes,notes_url,action_url,icon_image,display_name,notify,acknowledged,passive_checks,active_checks,event_handler_enabled,flapping,scheduled_downtime_depth,flap_detection,criticality", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - }, - { - "name": "Service list with viewType parameter", - "item": [ - { - "name": "Service List with viewType problems", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&viewType=problems", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "viewType", - "value": "problems", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Service List with viewType unhandled critical", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "var helpers = eval(globals.loadHelpers);", - "helpers.test200();", - "helpers.testJson();" - ] - } - } - ], - "request": { - "method": "GET", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&viewType=unhandled_critical", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "list", - "equals": true - }, - { - "key": "object", - "value": "centreon_realtime_services", - "equals": true - }, - { - "key": "viewType", - "value": "unhandled_critical", - "equals": true - } - ] - } - }, - "response": [] - } - ], - "_postman_isSubFolder": true - } - ] - }, - { - "name": "50-Downtime Realtime", - "item": [ - { - "name": "Addhost Realtime", - "event": [ - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "postman.setGlobalVariable(\"fixed\", \"1\");", - "", - "var date = new Date();", - "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", - " ('0' + date.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"start_time\", datetime_start);", - "", - "var dateEnd = new Date(date.setHours(date.getHours()+1));", - "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", - "('0' + dateEnd.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"end_time\", datetime_end);", - "" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HOST;{{host_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;0\"\n}\n" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addservice Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - }, - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "postman.setGlobalVariable(\"fixed\", \"1\");", - "", - "var date = new Date();", - "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", - " ('0' + date.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"start_time\", datetime_start);", - "", - "var dateEnd = new Date(date.setHours(date.getHours()+1));", - "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", - "('0' + dateEnd.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"end_time\", datetime_end);", - "" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SVC;{{host_name}},{{service_description}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addhostgroup Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - }, - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "postman.setGlobalVariable(\"fixed\", \"1\");", - "", - "var date = new Date();", - "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", - " ('0' + date.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"start_time\", datetime_start);", - "", - "var dateEnd = new Date(date.setHours(date.getHours()+1));", - "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", - "('0' + dateEnd.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"end_time\", datetime_end);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HG;{{hg_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;0\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addservicegroup Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - }, - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "postman.setGlobalVariable(\"fixed\", \"1\");", - "", - "var date = new Date();", - "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", - " ('0' + date.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"start_time\", datetime_start);", - "", - "var dateEnd = new Date(date.setHours(date.getHours()+1));", - "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", - "('0' + dateEnd.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"end_time\", datetime_end);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SG;{{sg_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Addinstance Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;" - ] - } - }, - { - "listen": "prerequest", - "script": { - "type": "text/javascript", - "exec": [ - "postman.setGlobalVariable(\"fixed\", \"1\");", - "", - "var date = new Date();", - "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", - " ('0' + date.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"start_time\", datetime_start);", - "", - "var dateEnd = new Date(date.setHours(date.getHours()+1));", - "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", - "('0' + dateEnd.getMinutes()).slice(-2);", - "postman.setEnvironmentVariable(\"end_time\", datetime_end);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"INSTANCE;Central;{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Show Service Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "var contentType = postman.getResponseHeader(\"Content-Type\");", - "tests[\"Content-Type is application/json\"] = contentType === \"application/json\";", - "", - "var jsonData = JSON.parse(responseBody);", - "var result = jsonData.result;", - "", - "var schema = {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"host_name\": {", - " \"type\": \"string\"", - " },", - " \"service_name\": {", - " \"type\": \"string\"", - " },", - " \"author\": {", - " \"type\": \"string\"", - " },", - " \"actual_start_time\": {", - " \"type\": \"string\"", - " },", - " \"actual_end_time\": {", - " \"type\": \"string\"", - " },", - " \"start_time\": {", - " \"type\": \"string\"", - " },", - " \"end_time\": {", - " \"type\": \"string\"", - " },", - " \"comment_data\": {", - " \"type\": \"string\"", - " },", - " \"duration\": {", - " \"type\": \"string\"", - " },", - " \"fixed\": {", - " \"type\": \"string\"", - " },", - " \"url\": {", - " \"type\": \"string\"", - " }", - " },", - " \"additionalProperties\": false,", - " \"required\": [\"host_name\", \"service_name\", \"author\", \"actual_start_time\", \"actual_end_time\", \"start_time\", \"end_time\", \"comment_data\", \"duration\", \"fixed\", \"url\"]", - " }", - "}", - "", - "tests[\"Validate schema JSON\"] = tv4.validate(result, schema);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"show\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SVC;{{host_name}},{{service_description}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - }, - { - "name": "Show Host Realtime", - "event": [ - { - "listen": "test", - "script": { - "type": "text/javascript", - "exec": [ - "tests[\"Status code is 200\"] = responseCode.code === 200;", - "var contentType = postman.getResponseHeader(\"Content-Type\");", - "tests[\"Content-Type is application/json\"] = contentType === \"application/json\";", - "", - "var jsonData = JSON.parse(responseBody);", - "var result = jsonData.result;", - "", - "var schema = {", - " \"type\": \"array\",", - " \"items\": {", - " \"type\": \"object\",", - " \"properties\": {", - " \"host_name\": {", - " \"type\": \"string\"", - " },", - " \"author\": {", - " \"type\": \"string\"", - " },", - " \"actual_start_time\": {", - " \"type\": \"string\"", - " },", - " \"actual_end_time\": {", - " \"type\": \"string\"", - " },", - " \"start_time\": {", - " \"type\": \"string\"", - " },", - " \"end_time\": {", - " \"type\": \"string\"", - " },", - " \"comment_data\": {", - " \"type\": \"string\"", - " },", - " \"duration\": {", - " \"type\": \"string\"", - " },", - " \"fixed\": {", - " \"type\": \"string\"", - " },", - " \"url\": {", - " \"type\": \"string\"", - " }", - " },", - " \"additionalProperties\": false,", - " \"required\": [\"host_name\", \"author\", \"actual_start_time\", \"actual_end_time\", \"start_time\", \"end_time\", \"comment_data\", \"duration\", \"fixed\", \"url\"]", - " }", - "}", - "", - "tests[\"Validate schema JSON\"] = tv4.validate(result, schema);" - ] - } - } - ], - "request": { - "method": "POST", - "header": [ - { - "key": "Content-Type", - "value": "application/json" - }, - { - "key": "centreon-auth-token", - "value": "{{token}}" - } - ], - "body": { - "mode": "raw", - "raw": "{\n \"action\": \"show\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HOST;{{host_name}}\"\n}" - }, - "url": { - "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", - "protocol": "http", - "host": [ - "{{url}}" - ], - "path": [ - "centreon", - "api", - "index.php" - ], - "query": [ - { - "key": "action", - "value": "action", - "equals": true - }, - { - "key": "object", - "value": "centreon_clapi", - "equals": true - } - ] - } - }, - "response": [] - } - ] - } - ] + "variables": [], + "info": { + "name": "Centreon Web Rest API realtime", + "_postman_id": "a3390387-9951-1ff9-b164-5ac10459ac21", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" + }, + "item": [ + { + "name": "00-Authenticate", + "item": [ + { + "name": "Authenticate", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var jsonData = JSON.parse(responseBody);", + "postman.setEnvironmentVariable(\"token\",jsonData.authToken);", + "", + "postman.setGlobalVariable(\"loadHelpers\", function loadHelpers() {", + " \"use strict\";", + " let helpers = {};", + "", + " /** Test function to show this kludge is working. */", + " helpers.test200 = function test200() {", + " tests[\"Response returned 200\"] = responseCode.code === 200;", + " }", + " ", + " helpers.testJson = function testJson() {", + " tests[\"Content-Type header is application/json\"] = postman.getResponseHeader(\"Content-Type\") === 'application/json';", + " ", + " let result;", + " try {", + " JSON.parse(responseBody);", + " } catch (e) {", + " result = false;", + " }", + " result = true;", + " ", + " tests[\"Response body uses json format\"] = result;", + " }", + " ", + " helpers.notEmpty = function notEmpty() {", + " tests[\"Result is not empty\"] = JSON.parse(responseBody).length > 0;", + " }", + " ", + " helpers.checkHostListFormat = function checkHostListFormat(columns) {", + " if (typeof columns === 'undefined') {", + " columns = [\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"criticality\"];", + " }", + " ", + " let hostListSchema = {", + " \"$schema\": \"http://json-schema.org/draft-04/schema#\",", + " \"type\": \"array\",", + " \"items\": {\t\t", + " \"type\": \"object\",", + " \"required\": columns,", + " \"properties\": {", + " \"id\": { \"type\": \"string\" },", + " \"name\": { \"type \": \"string\" },", + " \"alias\": { \"type \": \"string\" },", + " \"address\": { \"type\": \"string\" },", + " \"state\": { \"type\": \"string\" },", + " \"state_type\": { \"type \": \"string\" },", + " \"output\": { \"type \": \"string\" },", + " \"max_check_attempts\": { \"type\": \"string\" },", + " \"check_attempt\": { \"type\": \"string\" },", + " \"last_check\": { \"type\": [\"string\", \"null\"] },", + " \"last_state_change\": { \"type\": [\"string\", \"null\"] },", + " \"last_hard_state_change\": { \"type\": [\"string\", \"null\"] },", + " \"acknowledged\": { \"type \": \"string\" },", + " \"instance_name\": { \"type \": \"string\" },", + " \"criticality\": { \"type\": [\"string\", \"null\"] }", + " },", + " \"additionalProperties\": true", + " }", + " };", + " tests[\"host list is well formated\"] = tv4.validate(JSON.parse(responseBody), hostListSchema);", + " }", + " ", + " helpers.checkServiceListFormat = function checkServiceListFormat(columns) {", + " if (typeof columns === 'undefined') {", + " columns = [\"host_id\", \"name\", \"description\", \"service_id\", \"state\", \"state_type\", \"output\", \"perfdata\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"criticality\"];", + " }", + " ", + " let serviceListSchema = {", + " \"$schema\": \"http://json-schema.org/draft-04/schema#\",", + " \"type\": \"array\",", + " \"items\": {\t\t", + " \"type\": \"object\",", + " \"required\": columns,", + " \"properties\": {", + " \"host_id\": { \"type\": \"string\" },", + " \"name\": { \"type \": \"string\" },", + " \"description\": { \"type \": \"string\" },", + " \"service_id\": { \"type\": \"string\" },", + " \"state\": { \"type\": \"string\" },", + " \"state_type\": { \"type \": \"string\" },", + " \"output\": { \"type \": \"string\" },", + " \"perfdata\": { \"type \": \"string\" },", + " \"max_check_attempts\": { \"type\": \"string\" },", + " \"check_attempt\": { \"type\": \"string\" },", + " \"last_check\": { \"type\": [\"string\", \"null\"] },", + " \"last_state_change\": { \"type\": [\"string\", \"null\"] },", + " \"last_hard_state_change\": { \"type\": [\"string\", \"null\"] },", + " \"acknowledged\": { \"type \": \"string\" },", + " \"criticality\": { \"type\": [\"string\", \"null\"] }", + " },", + " \"additionalProperties\": true", + " }", + " };", + " tests[\"service list is well formated\"] = tv4.validate(JSON.parse(responseBody), serviceListSchema);", + " }", + " ", + " helpers.checkHostList = function checkHostList(columns) {", + " helpers.test200();", + " helpers.testJson();", + " helpers.notEmpty();", + " helpers.checkHostListFormat(columns);", + " }", + " ", + " helpers.checkServiceList = function checkServiceList(columns) {", + " helpers.test200();", + " helpers.testJson();", + " helpers.notEmpty();", + " helpers.checkServiceListFormat(columns);", + " }", + "", + " return helpers;", + "} + '; loadHelpers();'); // when eval'd out of globals, execute it", + "tests[\"helpers initialized\"] = true;", + "" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/x-www-form-urlencoded" + } + ], + "body": { + "mode": "urlencoded", + "urlencoded": [ + { + "key": "username", + "value": "{{api_user}}", + "type": "text" + }, + { + "key": "password", + "value": "{{api_password}}", + "type": "text" + } + ] + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=authenticate", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "authenticate", + "equals": true + } + ] + } + }, + "response": [] + } + ] + }, + { + "name": "01-Base configuration", + "item": [ + { + "name": "10-Timeperiods", + "item": [ + { + "name": "Add tp", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"tp\",\n \"values\": \"{{tp_name}};{{tp_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam sunday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};sunday;{{tp_sunday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam monday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};monday;{{tp_monday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam tuesday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};tuesday;{{tp_tuesday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam wednesday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};wednesday;{{tp_wednesday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam thursday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};thursday;{{tp_thursday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam friday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};friday;{{tp_friday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam saturday", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"tp\",\n \"values\": \"{{tp_name}};saturday;{{tp_saturday}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "11-Commands", + "description": "Tests all commands to manage commands.", + "item": [ + { + "name": "Add command", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"cmd\",\n \"values\": \"{{command_name}};{{command_type}};{{command_line}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "21-Contacts", + "description": "Tests all commands to manage contact.", + "item": [ + { + "name": "Add contact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"contact\",\n \"values\": \"{{contact_name}};{{contact_alias}};test@localhost;{{contact_pwd}};0;0;en_US;Idap\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam hostnotifcmd", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifcmd;{{command_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam svcnotifcmd", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};svcnotifcmd;{{command_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam hostnotifperiod", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifperiod;{{tp_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam svcnotifperiod", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};svcnotifperiod;{{tp_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam hostnotifopt", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};hostnotifopt;{{contact_hostnotifopt}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam svcnotifopt", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"contact\",\n \"values\": \"{{contact_alias}};servicenotifopt;{{contact_svcnotifopt}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "22-Contactgroups", + "description": "Tests all commands to manage contact groups.", + "item": [ + { + "name": "Add contact group", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"cg\",\n \"values\": \"{{cg_name}};{{cg_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addcontact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"addcontact\",\n \"object\": \"cg\",\n \"values\": \"{{cg_name}};{{contact_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "23-Hostgroups", + "description": "Tests all commands to manage host groups.", + "item": [ + { + "name": "Add hostgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"hg\",\n \"values\": \"{{hg_name}};{{hg_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "24-Hosts_Categories", + "description": "Tests all commands to manage host categories.", + "item": [ + { + "name": "Add host category", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"hc\",\n \"values\": \"{{hc_name}};{{hc_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Set hc severity", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"hc\",\n \"values\": \"{{hc_name}};{{hc_severity_level}};{{hc_severity_icon}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "25-Services_Categories", + "description": "Tests all commands to manage service categories.", + "item": [ + { + "name": "Add service category", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"sc\",\n \"values\": \"{{sc_name}};{{sc_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Set sc severity", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"sc\",\n \"values\": \"{{sc_name}};{{sc_severity_level}};{{sc_severity_image}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "26-Servicegroups", + "description": "Tests all commands to manage service groups.", + "item": [ + { + "name": "Add service group", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"sg\",\n \"values\": \"{{sg_name}};{{sg_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "30-Hosts_Templates", + "item": [ + { + "name": "Create host template", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{htpl_name}};{{host_address}};;central;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam check_command", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};check_command;{{command_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam check_period", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};check_period;{{tp_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam max_check_attempts", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};max_check_attempts;{{host_max_check_attempts}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "equals": true, + "key": "action", + "value": "action" + }, + { + "equals": true, + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam snmp_community", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};snmp_community;{{host_snmp_community}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "equals": true, + "key": "action", + "value": "action" + }, + { + "equals": true, + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam snmp_version", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"htpl\",\n \"values\": \"{{htpl_name}};snmp_version;{{host_snmp_version}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "equals": true, + "key": "action", + "value": "action" + }, + { + "equals": true, + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Addcontactgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"addcontactgroup\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{cg_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{contact_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setseverity", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"htpl\",\n \"values\": \"{{htpl_name}};{{hc_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "31-Hosts", + "description": "Tests all commands to manage hosts", + "item": [ + { + "name": "Add host", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{host_alias}};{{host_address}};{{htpl_name}};Central;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam check_command", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"setparam\",\n \"object\":\"host\",\n \"values\": \"{{host_name}};check_command;{{command_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addtemplate", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"addtemplate\",\n \"object\":\"host\",\n \"values\": \"{{host_name}};{{htpl_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Applytpl", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\":\"applytpl\",\n \"object\":\"host\",\n \"values\": \"{{host_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontactgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{cg_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{contact_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Sethostgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"sethostgroup\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{hg_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setseverity", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"host\",\n \"values\": \"{{host_name}};{{hc_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Add host 2", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"host\",\n \"values\": \"{{host_name2}};{{host_alias}};0.0.0.0;{{htpl_name}};Central;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "40-Services_Templates", + "description": "Tests all commands to manage service templates.", + "item": [ + { + "name": "Add service template", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{stpl_alias}};\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam check_period", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};check_period;{{tp_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam check_command", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};check_command;{{command_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam max_check_attempts", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};max_check_attempts;{{stpl_max_check}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action" + }, + { + "key": "object", + "value": "centreon_clapi" + } + ] + } + }, + "response": [] + }, + { + "name": "Sethosttemplate", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"sethosttemplate\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{htpl_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{contact_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontactgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"stpl\",\n \"values\": \"{{stpl_description}};{{cg_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "41-Services", + "description": "Tests all commands to manage services.", + "item": [ + { + "name": "Add service", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{stpl_description}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setparam template", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setparam\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};template;{{stpl_description}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setseverity", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setseverity\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{sc_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontact", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontact\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{contact_alias}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Setcontactgroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setcontactgroup\",\n \"object\": \"service\",\n \"values\": \"{{host_name}};{{service_description}};{{cg_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Set servicegroup", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"setservice\",\n \"object\": \"sg\",\n \"values\": \"{{sg_name}};{{host_name}},{{service_description}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "99-Generate", + "item": [ + { + "name": "Generate configuration", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "", + "function wait(millis) {", + " var date = new Date();", + " var curDate = null;", + " do { curDate = new Date(); }", + " while(curDate-date < millis);", + "}", + "", + "wait(2000);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"APPLYCFG\",\n \"values\": \"Central\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + } + ] + }, + { + "name": "10-Host", + "item": [ + { + "name": "host list without parameters", + "item": [ + { + "name": "host list", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Host list with limit parameter", + "item": [ + { + "name": "Limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Limit with field name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList([\"name\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit=2&fields=name", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "2", + "equals": true + }, + { + "key": "fields", + "value": "name", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Limit with all fields", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList([\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"next_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"instance_id\", \"criticality\", \"passive_checks\", \"active_checks\", \"notify\", \"action_url\", \"notes_url\", \"notes\", \"icon_image\", \"icon_image_alt\", \"scheduled_downtime_depth\", \"flapping\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit=2&fields=id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "2", + "equals": true + }, + { + "key": "fields", + "value": "id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Host list with viewType parameter", + "item": [ + { + "name": "list with viewType", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=all,unhandled,problems", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "viewType", + "value": "all,unhandled,problems", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "with viewType all", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=all", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "viewType", + "value": "all", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "with viewType unhandled", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=unhandled", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "viewType", + "value": "unhandled", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "with viewType problems", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&viewType=problems", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "viewType", + "value": "problems", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "viewType with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=all,unhandled,problems", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "viewType", + "value": "all,unhandled,problems", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "viewType all with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=all", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "viewType", + "value": "all", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "viewType unhandled with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=unhandled", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "viewType", + "value": "unhandled", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "viewType problems with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&viewType=problems", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "viewType", + "value": "problems", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Host list with status filter", + "item": [ + { + "name": "status up with state and name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=up&fields=name, state", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "status", + "value": "up", + "equals": true + }, + { + "key": "fields", + "value": "name, state", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "status down with state and name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=down&fields=name, state", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "status", + "value": "down", + "equals": true + }, + { + "key": "fields", + "value": "name, state", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "status unreachable with state and name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=unreachable&fields=name, state", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "status", + "value": "unreachable", + "equals": true + }, + { + "key": "fields", + "value": "name, state", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "status pending with state and name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&status=pending&fields=name, state", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "status", + "value": "pending", + "equals": true + }, + { + "key": "fields", + "value": "name, state", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "status all with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList([\"name\", \"state\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&limit={{my_limit}}&status=all&fields=name, state", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "status", + "value": "all", + "equals": true + }, + { + "key": "fields", + "value": "name, state", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Host list by Host", + "item": [ + { + "name": "search by host name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with status up", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=up", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "status", + "value": "up", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with status down", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=down", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "status", + "value": "down", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with status pending", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=pending", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "status", + "value": "pending", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with status unreachable", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&status=unreachable", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "status", + "value": "unreachable", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with id field", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList([\"id\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&fields=id", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "fields", + "value": "id", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "search by host name with all fields", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkHostList([\"id\", \"name\", \"alias\", \"address\", \"state\", \"state_type\", \"output\", \"max_check_attempts\", \"check_attempt\", \"last_check\", \"next_check\", \"last_state_change\", \"last_hard_state_change\", \"acknowledged\", \"instance_name\", \"instance_id\", \"criticality\", \"passive_checks\", \"active_checks\", \"notify\", \"action_url\", \"notes_url\", \"notes\", \"icon_image\", \"icon_image_alt\", \"scheduled_downtime_depth\", \"flapping\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_hosts&search={{host_name}}&fields=id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_hosts", + "equals": true + }, + { + "key": "search", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "fields", + "value": "id,name,alias,address,state,state_type,output,max_check_attempts,check_attempt,last_check,next_check,last_state_change,last_hard_state_change,acknowledged,instance,instance_id,criticality,passive_checks,active_checks,notify,action_url,notes_url,notes,icon_image,icon_image_alt,scheduled_downtime_depth,flapping", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + } + ] + }, + { + "name": "20-Service", + "item": [ + { + "name": "Service list without parameters", + "item": [ + { + "name": "Service List", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Service list by host and service", + "item": [ + { + "name": "Service List by host name", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "searchHost", + "value": "{{host_name}}", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Service List by service description", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}&searchService={{service_description}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "searchHost", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "searchService", + "value": "{{service_description}}", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Service List by host name and service description", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&searchHost={{host_name}}&searchService={{service_description}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "searchHost", + "value": "{{host_name}}", + "equals": true + }, + { + "key": "searchService", + "value": "{{service_description}}", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Service list with limit parameter", + "item": [ + { + "name": "Service List with limit", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Service List with limit and one field", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList([\"service_id\"]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}&fields=id", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "fields", + "value": "id", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Service List with limit and all fields", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.checkServiceList([", + " \"host_id\",", + " \"host_name\",", + " \"host_alias\",", + " \"host_address\",", + " \"host_state\",", + " \"host_state_type\",", + " \"host_output\",", + " \"host_last_check\",", + " \"host_next_check\",", + " \"host_acknowledged\",", + " \"instance_name\",", + " \"instance_id\",", + " \"host_action_url\",", + " \"host_notes_url\",", + " \"host_icon_image\",", + " \"description\",", + " \"state\",", + " \"state_type\",", + " \"service_id\",", + " \"output\",", + " \"perfdata\",", + " \"current_attempt\",", + " \"last_update\",", + " \"last_state_change\",", + " \"last_hard_state_change\",", + " \"last_check\",", + " \"next_check\",", + " \"max_check_attempts\",", + " \"notes\",", + " \"notes_url\",", + " \"action_url\",", + " \"icon_image\",", + " \"display_name\",", + " \"notify\",", + " \"acknowledged\",", + " \"passive_checks\",", + " \"active_checks\",", + " \"event_handler_enabled\",", + " \"flapping\",", + " \"scheduled_downtime_depth\",", + " \"flap_detection\",", + " \"criticality\"", + " ]);" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&limit={{my_limit}}&fields=host_id,host_name,host_alias,host_address,host_state,host_state_type,host_output,host_last_check,host_next_check,host_acknowledged,instance,instance_id,host_action_url,host_notes_url,host_icon_image,description,state,state_type,id,output,perfdata,current_attempt,last_update,last_state_change,last_hard_state_change,last_check,next_check,max_check_attempts,notes,notes_url,action_url,icon_image,display_name,notify,acknowledged,passive_checks,active_checks,event_handler_enabled,flapping,scheduled_downtime_depth,flap_detection,criticality", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "limit", + "value": "{{my_limit}}", + "equals": true + }, + { + "key": "fields", + "value": "host_id,host_name,host_alias,host_address,host_state,host_state_type,host_output,host_last_check,host_next_check,host_acknowledged,instance,instance_id,host_action_url,host_notes_url,host_icon_image,description,state,state_type,id,output,perfdata,current_attempt,last_update,last_state_change,last_hard_state_change,last_check,next_check,max_check_attempts,notes,notes_url,action_url,icon_image,display_name,notify,acknowledged,passive_checks,active_checks,event_handler_enabled,flapping,scheduled_downtime_depth,flap_detection,criticality", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + }, + { + "name": "Service list with viewType parameter", + "item": [ + { + "name": "Service List with viewType problems", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&viewType=problems", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "viewType", + "value": "problems", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Service List with viewType unhandled critical", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "var helpers = eval(globals.loadHelpers);", + "helpers.test200();", + "helpers.testJson();" + ] + } + } + ], + "request": { + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=list&object=centreon_realtime_services&viewType=unhandled_critical", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "list", + "equals": true + }, + { + "key": "object", + "value": "centreon_realtime_services", + "equals": true + }, + { + "key": "viewType", + "value": "unhandled_critical", + "equals": true + } + ] + } + }, + "response": [] + } + ], + "_postman_isSubFolder": true + } + ] + }, + { + "name": "50-Downtime Realtime", + "item": [ + { + "name": "Addhost Realtime", + "event": [ + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "postman.setGlobalVariable(\"fixed\", \"1\");", + "", + "var date = new Date();", + "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", + " ('0' + date.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"start_time\", datetime_start);", + "", + "var dateEnd = new Date(date.setHours(date.getHours()+1));", + "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", + "('0' + dateEnd.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"end_time\", datetime_end);", + "" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HOST;{{host_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;0\"\n}\n" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addservice Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + }, + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "postman.setGlobalVariable(\"fixed\", \"1\");", + "", + "var date = new Date();", + "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", + " ('0' + date.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"start_time\", datetime_start);", + "", + "var dateEnd = new Date(date.setHours(date.getHours()+1));", + "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", + "('0' + dateEnd.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"end_time\", datetime_end);", + "" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SVC;{{host_name}},{{service_description}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addhostgroup Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + }, + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "postman.setGlobalVariable(\"fixed\", \"1\");", + "", + "var date = new Date();", + "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", + " ('0' + date.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"start_time\", datetime_start);", + "", + "var dateEnd = new Date(date.setHours(date.getHours()+1));", + "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", + "('0' + dateEnd.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"end_time\", datetime_end);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HG;{{hg_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;0\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addservicegroup Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + }, + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "postman.setGlobalVariable(\"fixed\", \"1\");", + "", + "var date = new Date();", + "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", + " ('0' + date.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"start_time\", datetime_start);", + "", + "var dateEnd = new Date(date.setHours(date.getHours()+1));", + "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", + "('0' + dateEnd.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"end_time\", datetime_end);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SG;{{sg_name}};{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Addinstance Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;" + ] + } + }, + { + "listen": "prerequest", + "script": { + "type": "text/javascript", + "exec": [ + "postman.setGlobalVariable(\"fixed\", \"1\");", + "", + "var date = new Date();", + "var datetime_start = date.getFullYear() + \"/\" + ('0' + (date.getMonth()+1)).slice(-2) + \"/\" + ('0' + date.getDate()).slice(-2) + \" \" + ('0' + date.getHours()).slice(-2) + \":\" + ", + " ('0' + date.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"start_time\", datetime_start);", + "", + "var dateEnd = new Date(date.setHours(date.getHours()+1));", + "var datetime_end = dateEnd.getFullYear() + \"/\" + ('0' + (dateEnd.getMonth()+1)).slice(-2) + \"/\" + ('0' + dateEnd.getDate()).slice(-2) + \" \" + ('0' + dateEnd.getHours()).slice(-2) + \":\" + ", + "('0' + dateEnd.getMinutes()).slice(-2);", + "postman.setEnvironmentVariable(\"end_time\", datetime_end);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"add\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"INSTANCE;Central;{{start_time}};{{end_time}};1;3600;Ceci est un commentaire;\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Show Service Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "var contentType = postman.getResponseHeader(\"Content-Type\");", + "tests[\"Content-Type is application/json\"] = contentType === \"application/json\";", + "", + "var jsonData = JSON.parse(responseBody);", + "var result = jsonData.result;", + "", + "var schema = {", + " \"type\": \"array\",", + " \"items\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"id\": {", + " \"type\": \"string\"", + " },", + " \"host_name\": {", + " \"type\": \"string\"", + " },", + " \"service_name\": {", + " \"type\": \"string\"", + " },", + " \"author\": {", + " \"type\": \"string\"", + " },", + " \"actual_start_time\": {", + " \"type\": \"string\"", + " },", + " \"actual_end_time\": {", + " \"type\": \"string\"", + " },", + " \"start_time\": {", + " \"type\": \"string\"", + " },", + " \"end_time\": {", + " \"type\": \"string\"", + " },", + " \"comment_data\": {", + " \"type\": \"string\"", + " },", + " \"duration\": {", + " \"type\": \"string\"", + " },", + " \"fixed\": {", + " \"type\": \"string\"", + " },", + " \"url\": {", + " \"type\": \"string\"", + " }", + " },", + " \"additionalProperties\": false,", + " \"required\": [\"id\", \"host_name\", \"service_name\", \"author\", \"actual_start_time\", \"actual_end_time\", \"start_time\", \"end_time\", \"comment_data\", \"duration\", \"fixed\", \"url\"]", + " }", + "}", + "", + "tests[\"Validate schema JSON\"] = tv4.validate(result, schema);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"show\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"SVC;{{host_name}},{{service_description}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + }, + { + "name": "Show Host Realtime", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": [ + "tests[\"Status code is 200\"] = responseCode.code === 200;", + "var contentType = postman.getResponseHeader(\"Content-Type\");", + "tests[\"Content-Type is application/json\"] = contentType === \"application/json\";", + "", + "var jsonData = JSON.parse(responseBody);", + "var result = jsonData.result;", + "", + "var schema = {", + " \"type\": \"array\",", + " \"items\": {", + " \"type\": \"object\",", + " \"properties\": {", + " \"id\": {", + " \"type\": \"string\"", + " },", + " \"host_name\": {", + " \"type\": \"string\"", + " },", + " \"author\": {", + " \"type\": \"string\"", + " },", + " \"actual_start_time\": {", + " \"type\": \"string\"", + " },", + " \"actual_end_time\": {", + " \"type\": \"string\"", + " },", + " \"start_time\": {", + " \"type\": \"string\"", + " },", + " \"end_time\": {", + " \"type\": \"string\"", + " },", + " \"comment_data\": {", + " \"type\": \"string\"", + " },", + " \"duration\": {", + " \"type\": \"string\"", + " },", + " \"fixed\": {", + " \"type\": \"string\"", + " },", + " \"url\": {", + " \"type\": \"string\"", + " }", + " },", + " \"additionalProperties\": false,", + " \"required\": [\"id\", \"host_name\", \"author\", \"actual_start_time\", \"actual_end_time\", \"start_time\", \"end_time\", \"comment_data\", \"duration\", \"fixed\", \"url\"]", + " }", + "}", + "", + "tests[\"Validate schema JSON\"] = tv4.validate(result, schema);" + ] + } + } + ], + "request": { + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json" + }, + { + "key": "centreon-auth-token", + "value": "{{token}}" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"action\": \"show\",\n \"object\": \"RTDOWNTIME\",\n \"values\": \"HOST;{{host_name}}\"\n}" + }, + "url": { + "raw": "http://{{url}}/centreon/api/index.php?action=action&object=centreon_clapi", + "protocol": "http", + "host": [ + "{{url}}" + ], + "path": [ + "centreon", + "api", + "index.php" + ], + "query": [ + { + "key": "action", + "value": "action", + "equals": true + }, + { + "key": "object", + "value": "centreon_clapi", + "equals": true + } + ] + } + }, + "response": [] + } + ] + } + ] } \ No newline at end of file diff --git a/www/class/centreon-clapi/centreonRtDowntime.class.php b/www/class/centreon-clapi/centreonRtDowntime.class.php index a6c482cfed2..092407f9ff3 100644 --- a/www/class/centreon-clapi/centreonRtDowntime.class.php +++ b/www/class/centreon-clapi/centreonRtDowntime.class.php @@ -228,6 +228,7 @@ public function show($parameters = null) public function showHost($hostList) { $fields = array( + 'id', 'host_name', 'author', 'actual_start_time', @@ -323,6 +324,7 @@ public function showSvc($svcList) $existingService = array(); $fields = array( + 'id', 'host_name', 'service_name', 'author', @@ -729,4 +731,38 @@ private function addInstanceDowntime( throw new CentreonClapiException(self::OBJECT_NOT_FOUND . ' INSTANCE : ' . implode('|', $unknownPoller)); } } + + /** + * @param null $parameters + * @throws CentreonClapiException + */ + public function cancel($parameters = null) + { + if (empty($parameters) || is_null($parameters)) { + throw new CentreonClapiException(self::MISSINGPARAMETER); + } + $listDowntime = explode('|', $parameters); + $unknownDowntime = array(); + + foreach ($listDowntime as $downtime) { + $infoDowntime = $this->object->getCurrentDowntime($downtime); + + if ($infoDowntime) { + $hostName = $this->hostObject->getHostName($infoDowntime['host_id']); + if (is_null($infoDowntime['service_id'])) { + $this->externalCmdObj->deleteDowntime('HOST', array($hostName . ';' . $downtime => 'on')); + } else { + $this->externalCmdObj->deleteDowntime('SVC', array($hostName . ';' . $downtime => 'on')); + } + } else { + $unknownDowntime[] = $downtime; + } + } + + if (count($unknownDowntime)) { + throw new CentreonClapiException( + self::OBJECT_NOT_FOUND . ' DOWNTIME ID : ' . implode('|', $unknownDowntime) + ); + } + } }