UserService · UserService_UpdateUser
基于协议生成的参考。授权与实例策略仍然生效。结构描述继承自 MIT 许可的应用接口定义;本站不会向真实服务执行示例。
访问权限
需要指定账号的所有者或实例管理员;字段和生命周期限制仍然适用,所有者权限不代表可以修改管理员专用字段。
支持字段与生命周期检查
使用显式掩码。支持 username、display_name、email、avatar_url、description、role、state 与 password。role/state 仅管理员可改;实例策略可阻止用户名或显示名称变更。归档用户不能导致空间失去有效管理员。声明的 allowMissing 不会创建缺失用户。修改密码也影响刷新会话,凭据变更应使用账号的交互式安全流程。
请求
UpdateUser updates a user.
PATCH
/api/v1/users/{user}参数
| 名称 / 位置 | 类型 / 是否必需 | 描述 |
|---|---|---|
userpath | string 必需 | The user id. |
updateMaskquery | string (field-mask) 必需(接口描述) | Required. The list of fields to update. |
allowMissingquery | boolean OpenAPI 未标记为必需 | Optional. If set to true, allows updating sensitive fields. |
请求体
必需
application/json · User
响应
200 · OK
application/json · User
default · Default error response
application/json · Status
完整操作定义
下方保留全部已声明约束、媒体类型和响应细节。结构引用链接到完整定义。
展开 JSON 定义
{
"tags": [
"UserService"
],
"description": "UpdateUser updates a user.",
"operationId": "UserService_UpdateUser",
"parameters": [
{
"name": "user",
"in": "path",
"description": "The user id.",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "updateMask",
"in": "query",
"description": "Required. The list of fields to update.",
"schema": {
"type": "string",
"format": "field-mask"
}
},
{
"name": "allowMissing",
"in": "query",
"description": "Optional. If set to true, allows updating sensitive fields.",
"schema": {
"type": "boolean"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/User"
}
}
}
},
"default": {
"description": "Default error response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Status"
}
}
}
}
}
}