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

service.get

Leírás

integer/array service.get(object parameters)

A módszer lehetővé teszi a szolgáltatások lekérését a megadottak szerint paramétereket.

Ez a módszer bármilyen típusú felhasználó számára elérhető. Engedélyek A metódus meghívása a felhasználói szerepkör beállításaiban visszavonható. Lásd: User roles további információért.

Parameters

(object) Parameters defining the desired output.

The method supports the following parameters.

Parameter Type
serviceids string/array Return only services with the given IDs.
parentids string/array Return only services that are linked to the given parent services.
deep_parentids flag Return all direct and indirect child services. Used together with parentids.
childids string/array Return only services that are linked to the given child services.
evaltype integer Rules for tag searching.

Possible values:
0 - (default) And/Or;
2 - Or.
tags object/array of objects Return only services with given tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value.
Format: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].
An empty array returns all services.

Possible operator values:
0 - (default) Contains;
1 - Equals;
2 - Does not contain;
3 - Does not equal;
4 - Exists;
5 - Does not exist.
problem_tags object/array of objects Return only services with given problem tags. Exact match by tag and case-sensitive or case-insensitive search by tag value depending on operator value.
Format: [{"tag": "<tag>", "value": "<value>", "operator": "<operator>"}, ...].
An empty array returns all services.

Possible operator values:
0 - (default) Contains;
1 - Equals;
2 - Does not contain;
3 - Does not equal;
4 - Exists;
5 - Does not exist.
without_problem_tags flag Return only services without problem tags.
slaids string/array Return only services that are linked to the specific SLA(s).
selectChildren query Return a children property with the child services.

Supports count.
selectParents query Return a parents property with the parent services.

Supports count.
selectTags query Return a tags property with service tags.

Supports count.
selectProblemEvents query Return a problem_events property with an array of problem event objects.

The problem event object has the following properties:
eventid - (string) Event ID;
severity - (string) Current event severity;
name - (string) Resolved event name.

Supports count.
selectProblemTags query Return a problem_tags property with problem tags.

Supports count.
selectStatusRules query Return a status_rules property with status rules.

Supports count.
selectStatusTimeline object/array of objects Return a status_timeline property containing service state changes for given periods.

Format [{"period_from": "<period_from>", "period_to": "<period_to>"}, ...] - period_from being a starting date (inclusive; integer timestamp) and period_to being an ending date (exclusive; integer timestamp) for the period you're interested in.

Returns an array of entries containing a start_value property and an alarms array for the state changes within specified periods.
sortfield string/array Sort the result by the given properties.

Possible values are: serviceid, name, status, sortorder and 'created_at. | | countOutput | boolean | These parameters being common for allget` 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

Visszatérési értékek

(integer/array) A következőket adja vissza:

  • objektumok tömbje;
  • a letöltött objektumok száma, ha a countOutput paraméter használva volt.

Példák

Retrieving all services

Retrieve all data about all services and their dependencies.

Request:

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

Response:

{
           "jsonrpc": "2.0",
           "result": [
               {
                   "serviceid": "1",
                   "name": "My Service - 0001",
                   "status": "-1",
                   "algorithm": "2",
                   "sortorder": "0",
                   "weight": "0",
                   "propagation_rule": "0",
                   "propagation_value": "0",
                   "description": "My Service Description 0001.",
                   "uuid": "dfa4daeaea754e3a95c04d6029182681",
                   "created_at": "946684800",
                   "readonly": false,
                   "parents": [],
                   "children": []
               },
               {
                   "serviceid": "2",
                   "name": "My Service - 0002",
                   "status": "-1",
                   "algorithm": "2",
                   "sortorder": "0",
                   "weight": "0",
                   "propagation_rule": "0",
                   "propagation_value": "0",
                   "description": "My Service Description 0002.",
                   "uuid": "20ea0d85212841219130abeaca28c065",
                   "created_at": "946684800",
                   "readonly": false,
                   "parents": [],
                   "children": []
               }
           ],
           "id": 1
       }

Forrás

CService::get() az ui/include/classes/api/services/CService.php-ban.