[comment]: # translation:outdated

[comment]: # ({c289fd9d-c289fd9d})
# 更新

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

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

`object httptest.update(object/array webScenarios)`

此方法允许更新存在的Web场景。

::: noteclassic
此方法只有*Admin(管理员)* 和 *Super admin(超级管理员)* 用户可用。可以在用户角色设置中撤销调用该方法的权限。更多信息请查看 [用户角色](/manual/web_interface/frontend_sections/administration/user_roles)。
:::

[comment]: # ({/d8b8edbd-b09ad465})

[comment]: # ({183f0ffe-83b60d28})
### 参数

`(object/array)` 要更新的 Web 场景属性。

必须为每个 Web 场景定义 `httptestid` 属性，所有其他属性都是可选的。只有传递的属性才会更新，其他所有属性保持不变。

除了 [标准 Web 场景属性](object#web_scenario)，该方法还接受以下参数。

|参数|[类型](/manual/api/reference_commentary#data_types)|描述|
|--|--|------|
|steps|array|[场景步骤](/manual/api/reference/httptest/object#scenario_step) 以替换现有步骤。|
|tags|array|[Web 场景标签](/manual/api/reference/httptest/object#web_scenario_tag)。|

[comment]: # ({/183f0ffe-83b60d28})

[comment]: # ({02282fdb-02282fdb})
### 返回值

`(object)` 返回一个对象，其中包含 `httptestid` 属性下已更新的 Web 场景的 ID。

[comment]: # ({/02282fdb-02282fdb})

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

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

[comment]: # ({6fefc423-4c3bf00e})
#### 启用一个Web场景

启动一个Web场景，即将其状态设置为“0”。

[请求](/manual/api#执行请求):

```json
{
    "jsonrpc": "2.0",
    "method": "httptest.update",
    "params": {
        "httptestid": "5",
        "status": 0
    },
    "auth": "700ca65537074ec963db7efabda78259",
    "id": 1
}
```

响应：

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

[comment]: # ({/6fefc423-4c3bf00e})

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

- [场景步骤](object#场景步骤)

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

[comment]: # ({628fc1ff-628fc1ff})
### 源码

*ui/include/classes/api/services/CHttpTest.php* 中的 CHttpTest::update()。

[comment]: # ({/628fc1ff-628fc1ff})
