创建强制下线任务接口

创建针对桌面客户端的强制下线任务,指定人员范围、原因和用户提示。可立即执行或在指定时间执行,响应返回任务状态和时间信息。

所需权限

所需权限资源Scope资源服务
强制下线任务执行(执行)force-logout-tasksadmin.v1.force-logout-tasks.executeqwenwork-biz-service

POST /api/openapi/v1/force-logout-tasks

认证与请求头

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

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

请求参数

名称位置类型必填说明示例
Idempotency-Keyheaderstring必填本次写操作的幂等键。同一操作重试时复用相同键和请求内容,避免重复处理。"<string>"
execution_modebodystring必填任务的执行方式:立即执行或定时执行。 可选值:immediate、scheduled。"immediate"
promptbodystring必填任务向受影响用户提供的提示内容。 最多字符数:50。"<string>"
reasonbodystring必填执行本次操作的原因说明。 最多字符数:100。"<string>"
scheduled_atbodystring | null · date-time定时执行任务的计划时间。"2026-08-27T10:00:00Z"
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"
target_clientbodystring必填需要强制下线的客户端,当前只支持 pc(桌面客户端)。"pc"

请求示例

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

curl --request POST --url '<BASE_URL>/api/openapi/v1/force-logout-tasks' --header 'Authorization: Bearer <API_KEY>' --header 'Idempotency-Key: <UNIQUE_REQUEST_ID>' --header 'Content-Type: application/json' --data '{  "execution_mode": "immediate",  "prompt": "<string>",  "reason": "<string>",  "scheduled_at": "2026-08-27T10:00:00Z",  "scope_type": "all",  "subjects": [{"id": "<uuid>","name": "<string>","type": "department"}  ],  "target_client": "pc"}'

响应

201 创建成功,返回新建的记录。

名称类型必填说明示例
created_atstring · date-time此记录的创建时间。"2026-08-27T10:00:00Z"
created_bystring | null · uuid创建者的用户标识。"<uuid>"
created_by_emailstring创建者的邮箱。"<string>"
created_by_namestring创建者的姓名。"<string>"
executed_atstring | null · date-time任务实际执行的时间。"2026-08-27T10:00:00Z"
execution_modestring任务的执行方式:立即执行或定时执行。 可选值:immediate、scheduled。"immediate"
expires_atstring | null · date-time任务的失效时间。"2026-08-27T10:00:00Z"
idstring · uuid此记录的唯一标识,查询、更新或删除对应记录时使用。"<uuid>"
promptstring任务向受影响用户提供的提示内容。"<string>"
reasonstring执行本次操作的原因说明。"<string>"
scheduled_atstring | null · date-time定时执行任务的计划时间。"2026-08-27T10:00:00Z"
scope_typestring人员范围:all 为所有用户,specified 为 subjects 指定的对象。"all"
statusstring任务状态:pending 为待执行,executed 为已执行。"pending"
subjectsarray<OpenapifacadeScopeSubject>策略或任务选择的范围对象列表。[{"id":"<uuid>","name":"<string>","type":"department"}]
subjects[].idstring · uuid所选人员范围对象的标识。"<uuid>"
subjects[].namestring所选人员范围对象的显示名称。 最多字符数:255。"<string>"
subjects[].typestring人员范围对象的类型。 可选值:department、user_group、user。"department"
target_clientstring需要强制下线的客户端,当前只支持 pc(桌面客户端)。"pc"
updated_atstring · date-time此记录最后一次更新的时间。"2026-08-27T10:00:00Z"
updated_bystring | null · uuid最后修改者的用户标识。"<uuid>"
updated_by_emailstring最后修改者的邮箱。"<string>"
updated_by_namestring最后修改者的姓名。"<string>"
versioninteger · int64当前记录的版本号,修改或取消时提交最新读取的值以校验并发变更。0
{
  "created_at": "2026-08-27T10:00:00Z",
  "created_by": "<uuid>",
  "created_by_email": "<string>",
  "created_by_name": "<string>",
  "executed_at": "2026-08-27T10:00:00Z",
  "execution_mode": "immediate",
  "expires_at": "2026-08-27T10:00:00Z",
  "id": "<uuid>",
  "prompt": "<string>",
  "reason": "<string>",
  "scheduled_at": "2026-08-27T10:00:00Z",
  "scope_type": "all",
  "status": "pending",
  "subjects": [
    {
      "id": "<uuid>",
      "name": "<string>",
      "type": "department"
    }
  ],
  "target_client": "pc",
  "updated_at": "2026-08-27T10:00:00Z",
  "updated_by": "<uuid>",
  "updated_by_email": "<string>",
  "updated_by_name": "<string>",
  "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>"
}