# problem.get

### Description

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

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

### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|eventids|string/array|Return only problems with the given IDs.|
|groupids|string/array|Return only problems created by objects that belong to the given host groups.|
|hostids|string/array|Return only problems created by objects that belong to the given hosts.|
|objectids|string/array|Return only problems created by the given objects.|
|applicationids|string/array|Return only probles created by objects that belong to the given applications. Applies only if object is trigger or item.|
|source|integer|Return only problems with the given type.<br><br>Refer to the [problem event object page](object#problem) for a list of supported event types.<br><br>Default: 0 - problem created by a trigger.|
|object|integer|Return only problems created by objects of the given type.<br><br>Refer to the [problem event object page](object#problem) for a list of supported object types.<br><br>Default: 0 - trigger.|
|acknowledged|boolean|`true` - return acknowledged problems only;<br>`false` - unacknowledged only.|
|severities|integer/array|Return only problems with given trigger severities. Applies only if object is trigger.|
|tags|array of objects|Return only problems with given tags. Exact match by tag and case-insensitive search by value.<br>Format: `[{"tag": "<tag>", "value": "<value>"}, ...]`.<br>An empty array returns all problems.|
|recent|string|true - return PROBLEM and recently RESOLVED problems (depends on Display OK triggers for N seconds)<br>Default: false - UNRESOLVED problems only|
|eventid\_from|string|Return only problems with IDs greater or equal to the given ID.|
|eventid\_till|string|Return only problems with IDs less or equal to the given ID.|
|time\_from|timestamp|Return only problems that have been created after or at the given time.|
|time\_till|timestamp|Return only problems that have been created before or at the given time.|
|selectAcknowledges|query|Return problem's acknowledges in the `acknowledges` property. Acknowledges are sorted in reverse chronological order.<br><br>The problem acknowledgement object has the following properties:<br>`acknowledgeid` - `(string)` acknowledgement's ID;<br>`userid` - `(string)` ID of the user that acknowledged the event;<br>`eventid` - `(string)` ID of the acknowledged event;<br>`clock` - `(timestamp)` time when the event was acknowledged;<br>`message` - `(string)` text of the acknowledgement message;<br><br>Supports `count`.|
|selectTags|query|Return problem's tags. Output format: `[{"tag": "<tag>", "value": "<value>"}, ...]`.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `eventid`.|
|countOutput|flag|These parameters being common for all `get` methods are described in detail in the [reference commentary](/manual/api/reference_commentary#common_get_method_parameters) page.|
|editable|boolean|^|
|excludeSearch|flag|^|
|filter|object|^|
|limit|integer|^|
|output|query|^|
|preservekeys|flag|^|
|search|object|^|
|searchByAny|boolean|^|
|searchWildcardsEnabled|boolean|^|
|sortorder|string/array|^|
|startSearch|flag|^|

### Return values

`(integer/array)` Returns either:

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

### Examples

#### Retrieving trigger problem events

Retrieve recent events from trigger "15112."

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "problem.get",
    "params": {
        "output": "extend",
        "selectAcknowledges": "extend",
        "selectTags": "extend",
        "objectids": "15112",
        "recent": "true",
        "sortfield": ["eventid"],
        "sortorder": "DESC"
    },
    "auth": "67f45d3eb1173338e1b1647c4bdc1916",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "eventid": "1245463",
            "source": "0",
            "object": "0",
            "objectid": "15112",
            "clock": "1472457242",
            "ns": "209442442",
            "r_eventid": "1245468",
            "r_clock": "1472457285",
            "r_ns": "125644870",
            "correlationid": "0",
            "userid": "1",
            "acknowledges": [
                {
                    "acknowledgeid": "14443",
                    "userid": "1",
                    "eventid": "1245463",
                    "clock": "1472457281",
                    "message": "problem solved",
                    "action": "1"
                }
            ],
            "tags": [
                {
                    "tag": "test tag",
                    "value": "test value"
                }
            ]
        }
    ],
    "id": 1
}
```

### See also

-   [Alert](/manual/api/reference/alert/object)
-   [Item](/manual/api/reference/item/object)
-   [Host](/manual/api/reference/host/object)
-   [LLD rule](/manual/api/reference/discoveryrule/object#lld_rule)
-   [Trigger](/manual/api/reference/trigger/object)

### Source

CEvent::get() in
*frontends/php/include/classes/api/services/CProblem.php*.
