# correlation.get

### Description

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

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

### Parameters

`(object)` Parameters defining the desired output.

The method supports the following parameters.

|Parameter|Type|Description|
|---------|----|-----------|
|correlationids|string/array|Return only correlations with the given IDs.|
|selectFilter|query|Returns the correlation filter in the `filter` property.|
|selectOperations|query|Return correlation operations in the `operations` property.|
|sortfield|string/array|Sort the result by the given properties.<br><br>Possible values are: `correlationid`, `name` and `status`.|
|countOutput|boolean|These parameters being common for all `get` methods are described 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|^|

### Return values

`(integer/array)` Returns either:

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

### Examples

#### Retrieve correlations

Retrieve all configured correlations together with correlation
conditions and operations. The filter uses the "and/or" evaluation type,
so the `formula` property is empty and `eval_formula` is generated
automatically.

Request:

``` {.java}
{
    "jsonrpc": "2.0",
    "method": "correlation.get",
    "params": {
        "output": "extend",
        "selectOperations": "extend",
        "selectFilter": "extend"
    },
    "auth": "343baad4f88b4106b9b5961e77437688",
    "id": 1
}
```

Response:

``` {.java}
{
    "jsonrpc": "2.0",
    "result": [
        {
            "correlationid": "1",
            "name": "Correlation 1",
            "description": "",
            "status": "0",
            "filter": {
                "evaltype": "0",
                "formula": "",
                "conditions": [
                    {
                        "type": "3",
                        "oldtag": "error",
                        "newtag": "ok",
                        "formulaid": "A"
                    }
                ],
                "eval_formula": "A"
            },
            "operations": [
                {
                    "type": "0"
                }
            ]
        }
    ],
    "id": 1
}
```

### See also

-   [Correlation filter](object#correlation_filter)
-   [Correlation operation](object#correlation_operation)

### Source

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