[comment]: # ({c71a2e54-c71a2e54})
# correlation.update

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

[comment]: # ({b9562236-b9562236})
### 描述

`object correlation.update(object/array correlations)`

此方法允许update现有关联性.

::: noteclassic
此方法仅适用于*超级管理员*用户类型.
调用该方法的权限可在用户角色设置中撤销. 更多信息请参阅
[User
roles](/manual/web_interface/frontend_sections/administration/user_roles)

:::

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

[comment]: # ({ce355bf6-326bc80e})
### 参数

`(object/array)` 待更新的关联属性.

每个关联必须定义 `correlationid` 属性，其他属性均为可选。仅传递的属性会被更新，其余属性将保持不变。

除 [关联](object#关联) 外，该方法还接受以下参数。

| 参数 | [数据类型](/manual/api/reference_commentary#数据类型) | 描述 |
|--|--|------|
| filter | object | 用于替换当前过滤器的关联 [关联过滤器](/manual/api/reference/correlation/object#关联过滤器) object。 |
| operations | array | 用于替换现有操作的关联 [关联操作](/manual/api/reference/correlation/object#关联操作)。 |

[comment]: # ({/ce355bf6-326bc80e})

[comment]: # ({13e1dc13-13e1dc13})
### 返回值

`(object)` 返回一个包含更新后关联ID的object，这些ID位于`correlationids`属性下。

[comment]: # ({/13e1dc13-13e1dc13})

[comment]: # ({b41637d2-b41637d2})
### 示例

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

[comment]: # ({84b38e7f-67bb2dfb})
#### 禁用关联

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "correlation.update",
    "params": {
        "correlationid": "1",
        "status": "1"
    },
    "auth": "343baad4f88b4106b9b5961e77437688",
    "id": 1
}
```
响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "correlationids": [
            "1"
        ]
    },
    "id": 1
}
```

[comment]: # ({/84b38e7f-67bb2dfb})

[comment]: # ({8611676c-d6ef1778})
#### 替换条件但保留评估方法

请求:

```json
{
    "jsonrpc": "2.0",
    "method": "correlation.update",
    "params": {
        "correlationid": "1",
        "filter": {
            "conditions": [
                {
                    "type": 3,
                    "oldtag": "error",
                    "newtag": "ok"
                }
            ]
        }
    },
    "auth": "343baad4f88b4106b9b5961e77437688",
    "id": 1
}
```
响应:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "correlationids": [
            "1"
        ]
    },
    "id": 1
}
```

[comment]: # ({/8611676c-d6ef1778})

[comment]: # ({e7d15410-e7d15410})
### 另请参阅

-   [关联过滤器](object#关联过滤器)
-   [关联操作](object#关联操作)

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

[comment]: # ({40fa665f-40fa665f})
### 来源

CCorrelation::update() 位于
*ui/include/classes/api/services/CCorrelation.php* 文件中.

[comment]: # ({/40fa665f-40fa665f})
