This is a translation of the original English documentation page. Help us make it better.

service.get

Description

integer/array service.get(object parameters)

La méthode permet de récupérer des services en fonction des paramètres donnés.

Cette méthode est disponible à tous les types d'utilisateurs. Les autorisations d'appeler la méthode peuvent être révoquées dans les paramètres du le rôle d'utilisateur. Voir Rôles Utilisateur pour plus d'informations.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type Description
serviceids string/array Return only services with the given IDs.
parentids string/array Return only services with the given hard-dependent parent services.
childids string/array Return only services that are hard-dependent on the given child services.
selectParent query Return the hard-dependent parent service in the parent property.
selectDependencies query Return child service dependencies in the dependencies property.
selectParentDependencies query Return parent service dependencies in the parentDependencies property.
selectTimes query Return service times in the times property.
selectAlarms query Return service alarms in the alarms property.
selectTrigger query Return the associated trigger in the trigger property.
sortfield string/array Sort the result by the given properties.

Possible values are: name and sortorder.
countOutput boolean These parameters being common for all get methods are described in detail in the reference commentary.
editable boolean
excludeSearch boolean
filter object
limit integer
output query
preservekeys boolean
search object
searchByAny boolean
searchWildcardsEnabled boolean
sortorder string/array
startSearch boolean

Valeurs retournées

(integer/array) Retourne soit :

  • un tableau d'objets ;
  • le nombre d'objets récupérés, si le paramètre countOutput a été utilisé.

Exemples

Retrieving all services

Retrieve all data about all services and their dependencies.

Request:

{
           "jsonrpc": "2.0",
           "method": "service.get",
           "params": {
               "output": "extend",
               "selectDependencies": "extend"
           },
           "auth": "038e1d7b1735c6a5436ee9eae095879e",
           "id": 1
       }

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "serviceid": "2",
                   "name": "Server 1",
                   "status": "0",
                   "algorithm": "1",
                   "triggerid": "0",
                   "showsla": "1",
                   "goodsla": "99.9000",
                   "sortorder": "0",
                   "dependencies": []
               },
               {
                   "serviceid": "3",
                   "name": "Data center 1",
                   "status": "0",
                   "algorithm": "1",
                   "triggerid": "0",
                   "showsla": "1",
                   "goodsla": "99.9000",
                   "sortorder": "0",
                   "dependencies": [
                       {
                           "linkid": "11",
                           "serviceupid": "3",
                           "servicedownid": "2",
                           "soft": "0",
                           "sortorder": "0",
                           "serviceid": "2"
                       },
                       {
                           "linkid": "10",
                           "serviceupid": "3",
                           "servicedownid": "5",
                           "soft": "0",
                           "sortorder": "1",
                           "serviceid": "5"
                       }
                   ]
               },
               {
                   "serviceid": "5",
                   "name": "Server 2",
                   "status": "0",
                   "algorithm": "1",
                   "triggerid": "0",
                   "showsla": "1",
                   "goodsla": "99.9900",
                   "sortorder": "1",
                   "dependencies": []
               }
           ],
           "id": 1
       }

Source

CService::get() dans ui/include/classes/api/services/CService.php.