定时任务管理
更新时间:2026-07-10
查询设备定时任务列表
接口描述
查询当前设备下已启用的定时任务列表,无匹配任务时返回空数组。
请求语法
JSON
1GET /v2/aiagent/timing_tasks HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| appId | String | 是 | RequestParam | 互动应用id |
| deviceId | String | 是 | RequestParam | 设备id |
请求示例
JSON
1GET https://rtc-aiagent.baidubce.com/v2/aiagent/timing_tasks?appId=appxxx&deviceId=devicexxx
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
响应参数
| 名称 | 类型 | 描述 |
|---|---|---|
| data | Array | 定时任务列表;该设备无已启用定时任务时返回空数组 |
| data[].id | Integer | 定时任务id |
| data[].appId | String | 互动应用id |
| data[].deviceId | String | 设备id |
| data[].description | String | 定时任务描述,来源于创建任务时的原始用户query |
| data[].createTime | String | 定时任务创建时间,格式为 yyyy-MM-dd HH:mm:ss,时区为 Asia/Shanghai |
| data[].scheduleConf | String | 调度配置,cron 表达式或服务端保存的调度配置字符串 |
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
7
8{
9 "data": [
10 {
11 "id": 1001,
12 "appId": "appxxx",
13 "deviceId": "devicexxx",
14 "description": "每天上午9点提醒我开会",
15 "createTime": "2026-07-08 10:30:00",
16 "scheduleConf": "0 0 9 * * ?"
17 }
18 ]
19}
错误码
| HTTP状态码 | 错误信息 | 描述 |
|---|---|---|
| 400 | appId is required | appId 缺失或为空 |
| 400 | deviceId is required | deviceId 缺失或为空 |
| 500 | Internal Server Error | 服务端内部错误 |
删除设备定时任务
接口描述
按定时任务id批量删除当前设备下的定时任务。接口会校验任务归属,只删除属于请求中 appId 和 deviceId 的任务;不属于该设备或不存在的id会被跳过。
请求语法
JSON
1DELETE /v2/aiagent/timing_tasks HTTP/1.1
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: <bce-authorization-string>
请求头域
除公共头域外,无其它特殊头域。
请求参数
| 名称 | 类型 | 是否必选 | 参数位置 | 描述 |
|---|---|---|---|---|
| appId | String | 是 | RequestBody | 互动应用id |
| deviceId | String | 是 | RequestBody | 设备id |
| ids | Array |
是 | RequestBody | 待删除的定时任务id列表,应传入非空数组;为空或不传时服务端不会删除任何任务 |
请求示例
JSON
1DELETE https://rtc-aiagent.baidubce.com/v2/aiagent/timing_tasks
2host: rtc-aiagent.baidubce.com
3content-type: application/json
4authorization: {bce-authorization-string}
5x-bce-request-id: {bce-request-id}
6
7{
8 "appId": "appxxx",
9 "deviceId": "devicexxx",
10 "ids": [1001, 1002]
11}
响应参数
无
响应示例
JSON
1HTTP/1.1 200 OK
2x-bce-request-id: b06a9214-04d6-4a08-9f5d-966b04604cfb
3date: Mon, 05 Sep 2022 03:25:43 GMT
4transfer-encoding: chunked
5content-type: application/json;charset=UTF-8
6cache-control: no-cache
错误码
| HTTP状态码 | 错误信息 | 描述 |
|---|---|---|
| 400 | appId is required | appId 缺失或为空 |
| 400 | deviceId is required | deviceId 缺失或为空 |
| 500 | Internal Server Error | 服务端内部错误 |
评价此篇文章
