[comment]: # ({2587902b-2587902b})
# service.get

[comment]: # ({/2587902b-2587902b})

[comment]: # ({73ec97a5-73ec97a5})
### Description

`integer/array service.get(object parameters)`

The method allows to retrieve services according to the given
parameters.

[comment]: # ({/73ec97a5-73ec97a5})

[comment]: # ({11951f79-7f3c7bee})
### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|[Type](/manual/api/reference_commentary#data_types)|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 a [parent](/manual/api/reference/service/object#service_dependency) property with the hard-dependent parent service.|
|selectDependencies|query|Return a [dependencies](/manual/api/reference/service/object#service_dependency) property with child service dependencies.|
|selectParentDependencies|query|Return a [parentDependencies](/manual/api/reference/service/object#service_dependency) property with parent service dependencies.|
|selectTimes|query|Return a [times](/manual/api/reference/service/object#service_time) property with service times.|
|selectAlarms|query|Return an [alarms](/manual/api/reference/service/object#service_alarm) property with service alarms.|
|selectTrigger|query|Return a [trigger](/manual/api/reference/trigger/object) property with the associated trigger.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `name` and `sortorder`.|
|countOutput|boolean|These parameters being common for all `get` methods are described in detail in the [reference commentary](/manual/api/reference_commentary#common_get_method_parameters).|
|editable|boolean|^|
|excludeSearch|boolean|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|boolean|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|boolean|^|

[comment]: # ({/11951f79-7f3c7bee})

[comment]: # ({7223bab1-7223bab1})
### Return values

`(integer/array)` Returns either:

-   an array of objects;
-   the count of retrieved objects, if the `countOutput` parameter has
    been used.

[comment]: # ({/7223bab1-7223bab1})

[comment]: # ({b41637d2-b41637d2})
### Examples

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({8a5c94e6-8a5c94e6})
#### Retrieving all services

Retrieve all data about all services and their dependencies.

Request:

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

Response:

``` {.java}
{
    "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
}
```

[comment]: # ({/8a5c94e6-8a5c94e6})

[comment]: # ({05e3cf18-05e3cf18})
### Source

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

[comment]: # ({/05e3cf18-05e3cf18})
