更新可信设备策略接口

修改可信设备策略的名称、说明、优先级、校验设置和人员范围。需提交更新后的完整设置以及最新 version,服务端据此检查并发修改。

所需权限

所需权限资源Scope资源服务
可信设备策略管理(管理)trusted-device-policiesadmin.v1.trusted-device-policies.manageqwenwork-biz-service

PATCH /api/openapi/v1/trusted-device-policies/{policyId}

认证与请求头

使用应用 API Key 调用。当前接口校验上方独立 Scope;读取、管理与执行权限互不包含。

名称位置类型必填说明示例
Authorizationheaderstring应用 API Key,使用 Bearer 方式传递。Bearer qwk_\\*
X-Request-Idheaderstring可选的调用追踪标识;未传入时由服务端生成。req-20260831-001

请求参数

名称位置类型必填说明示例
policyIdpathstring · uuid必填需要操作的策略标识。"<uuid>"
descriptionbodystring可信设备策略的用途说明。 最多字符数:120。"<string>"
first_device_auto_trustbodyboolean必填是否将用户的首台登录设备自动标记为可信。false
namebodystring必填可信设备策略的名称。 最多字符数:40。"<string>"
prioritybodyinteger | null · int64必填策略匹配的优先级,数值越小越先匹配。 最小值:1。1
scope_typebodystring必填人员范围:all 为所有用户,specified 为 subjects 指定的对象。"all"
subjectsbodyarray | null必填策略或任务选择的范围对象列表。 最多项数:1000。[{"id":"<uuid>","name":"<string>","type":"department"}]
subjects[].idbodystring · uuid必填所选人员范围对象的标识。"<uuid>"
subjects[].namebodystring必填所选人员范围对象的显示名称。 最多字符数:255。"<string>"
subjects[].typebodystring必填人员范围对象的类型。 可选值:department、user_group、user。"department"
validation_enabledbodyboolean必填是否检查用户登录设备的可信状态。false
versionbodyinteger · int64必填当前记录的版本号,修改或取消时提交最新读取的值以校验并发变更。 最小值:0。0

请求示例

将 <BASE_URL> 替换为企业部署的千问办公 API 服务地址,并填写实际参数。示例中的占位值不能直接用于请求。

curl --request PATCH --url '<BASE_URL>/api/openapi/v1/trusted-device-policies/<policyId>' --header 'Authorization: Bearer <API_KEY>' --header 'Content-Type: application/json' --data '{  "description": "<string>",  "first_device_auto_trust": false,  "name": "<string>",  "priority": 1,  "scope_type": "all",  "subjects": [{"id": "<uuid>","name": "<string>","type": "department"}  ],  "validation_enabled": false,  "version": 0}'

响应

200 请求成功,返回当前或更新后的数据。

名称类型必填说明示例
created_atstring | null · date-time此记录的创建时间。"2026-08-27T10:00:00Z"
created_bystring | null · uuid创建者的用户标识。"<uuid>"
created_by_emailstring创建者的邮箱。"<string>"
created_by_namestring创建者的姓名。"<string>"
descriptionstring可信设备策略的用途说明。"<string>"
first_device_auto_trustboolean是否将用户的首台登录设备自动标记为可信。false
idstring · uuid此记录的唯一标识,查询、更新或删除对应记录时使用。"<uuid>"
is_defaultboolean是否为默认策略。false
namestring可信设备策略的名称。"<string>"
priorityinteger | null · int64策略匹配的优先级,数值越小越先匹配。0
scope_typestring人员范围:all 为所有用户,specified 为 subjects 指定的对象。"all"
subjectsarray<OpenapifacadeScopeSubject>策略或任务选择的范围对象列表。[{"id":"<uuid>","name":"<string>","type":"department"}]
subjects[].idstring · uuid所选人员范围对象的标识。"<uuid>"
subjects[].namestring所选人员范围对象的显示名称。 最多字符数:255。"<string>"
subjects[].typestring人员范围对象的类型。 可选值:department、user_group、user。"department"
updated_atstring | null · date-time此记录最后一次更新的时间。"2026-08-27T10:00:00Z"
updated_bystring | null · uuid最后修改者的用户标识。"<uuid>"
updated_by_emailstring最后修改者的邮箱。"<string>"
updated_by_namestring最后修改者的姓名。"<string>"
validation_enabledboolean是否检查用户登录设备的可信状态。false
versioninteger · int64当前记录的版本号,修改或取消时提交最新读取的值以校验并发变更。0
{
  "created_at": "2026-08-27T10:00:00Z",
  "created_by": "<uuid>",
  "created_by_email": "<string>",
  "created_by_name": "<string>",
  "description": "<string>",
  "first_device_auto_trust": false,
  "id": "<uuid>",
  "is_default": false,
  "name": "<string>",
  "priority": 0,
  "scope_type": "all",
  "subjects": [
    {
      "id": "<uuid>",
      "name": "<string>",
      "type": "department"
    }
  ],
  "updated_at": "2026-08-27T10:00:00Z",
  "updated_by": "<uuid>",
  "updated_by_email": "<string>",
  "updated_by_name": "<string>",
  "validation_enabled": false,
  "version": 0
}

default 请求失败,返回错误码和错误详情。

名称类型必填说明示例
codestring用于程序判断错误原因的稳定业务错误码。"<string>"
detailstring便于阅读的错误说明。"<string>"
detailsOpenapiErrorDetails字段校验失败时的详细信息。{"field":"<string>","reason":"<string>","suggestion":"<string>"}
details.fieldstring未通过校验的请求字段。"<string>"
details.reasonstring稳定的校验失败原因,用于判断字段为何不合法。"<string>"
details.suggestionstring建议采用的规范化字段值。"<string>"
errorstring稳定的 HTTP 错误类型。"<string>"
{
  "code": "<string>",
  "detail": "<string>",
  "details": {
    "field": "<string>",
    "reason": "<string>",
    "suggestion": "<string>"
  },
  "error": "<string>"
}