[comment]: # ({7063b41c-7063b41c})
# token.update

[comment]: # ({/7063b41c-7063b41c})

[comment]: # ({677d903b-f2679bab})
### 描述

`object token.update(object/array tokens)`

此方法允许 update 现有令牌。

::: noteclassic
用户角色需要拥有 *管理 API 令牌* [配置](/manual/web_interface/frontend_sections/users/user_roles#配置) 权限，才能管理其他用户的令牌。
:::

[comment]: # ({/677d903b-f2679bab})

[comment]: # ({416a8426-416a8426})
### 参数

`(object/array)` 要更新的令牌属性。

必须为每个令牌定义 `tokenid` 属性，所有其他属性是可选的。只有传递的属性将被更新，其他所有属性保持不变。

该方法接受带有[standard token properties](object)的令牌。

[comment]: # ({/416a8426-416a8426})

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

`(object)` 返回一个 object，其中包含更新的令牌 ID，
位于 `tokenids` 属性下。

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

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

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

[comment]: # ({305dae6e-4f041664})
#### 移除令牌过期

从令牌中移除过期日期。

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


```json
{
    "jsonrpc": "2.0",
    "method": "token.update",
    "params": {
        "tokenid": "2",
        "expires_at": "0"
    },
    "id": 1
}
```
响应：


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

[comment]: # ({/305dae6e-4f041664})

[comment]: # ({63651b34-63651b34})
### 来源

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

[comment]: # ({/63651b34-63651b34})
