跳转到主要内容
PATCH
/
v3
/
organizations
/
{org_id}
/
schedules
/
{schedule_id}
更新计划
curl --request PATCH \
  --url https://api.devin.ai/v3/organizations/{org_id}/schedules/{schedule_id} \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "agent": "devin",
  "enabled": true,
  "frequency": "<string>",
  "name": "<string>",
  "notify_on": "always",
  "playbook_id": "<string>",
  "prompt": "<string>",
  "schedule_type": "recurring",
  "scheduled_at": "2023-11-07T05:31:56Z",
  "run_as_user_id": "<string>",
  "slack_channel_id": "<string>",
  "slack_team_id": "<string>"
}
'
{
  "agent": "devin",
  "consecutive_failures": 123,
  "created_at": "2023-11-07T05:31:56Z",
  "created_by": "<string>",
  "enabled": true,
  "frequency": "<string>",
  "last_error_at": "2023-11-07T05:31:56Z",
  "last_error_message": "<string>",
  "last_executed_at": "2023-11-07T05:31:56Z",
  "name": "<string>",
  "notify_on": "always",
  "org_id": "<string>",
  "playbook": {
    "playbook_id": "<string>",
    "title": "<string>"
  },
  "prompt": "<string>",
  "scheduled_session_id": "<string>",
  "updated_at": "2023-11-07T05:31:56Z",
  "schedule_type": "recurring",
  "scheduled_at": "2023-11-07T05:31:56Z",
  "slack_channel_id": "<string>",
  "slack_team_id": "<string>"
}

权限

需要在组织级别拥有 ManageOrgSchedules 权限的服务账号。

注意事项

所有字段都是可选的。只有请求体中提供的字段会被更新。要禁用某个计划,将 enabled 设置为 false playbook_id 设置为 null 会清除关联的 playbook。 你可以在 recurringone_time 之间更改 schedule_type。当更改为 one_time 时,请提供 scheduled_at,其值必须是将来的 ISO 8601 日期时间。 当更改为 recurring 时,请提供 frequency,其值为有效的 cron 表达式。

执行身份

run_as_user_id 参数控制计划任务以哪个用户身份运行。计划任务被触发时,会在该用户下创建会话——该用户会收到通知,并且该会话会出现在其会话历史中。
  • 设置用户:提供一个有效的用户 ID 来更改执行身份。需要满足:
    1. 服务用户必须具有 ImpersonateOrgSessions 权限
    2. 目标用户必须是该组织的成员
    3. 目标用户必须具有 UseDevinSessions 权限
  • 清除 (设置为 null) :将计划任务恢复为以默认 bot 用户身份运行
  • 省略该字段:保持当前执行身份不变

授权

Authorization
string
header
必填

服务用户凭据(前缀:cog_)

路径参数

schedule_id
string
必填

请求体

application/json
agent
enum<string> | null
可用选项:
devin,
data_analyst,
advanced
enabled
boolean | null
frequency
string | null
name
string | null
notify_on
enum<string> | null
可用选项:
always,
failure,
never
playbook_id
string | null
prompt
string | null
schedule_type
enum<string> | null
可用选项:
recurring,
one_time
scheduled_at
string<date-time> | null
run_as_user_id
string | null

设置此计划运行时所使用的用户 ID。需要具有 ImpersonateOrgSessions 权限。目标用户必须是该组织成员。将其设置为 null 将恢复为默认的机器人用户。省略该字段则保持当前身份不变。

slack_channel_id
string | null
slack_team_id
string | null

响应

成功响应

agent
enum<string>
必填
可用选项:
devin,
data_analyst,
advanced
consecutive_failures
integer
必填
created_at
string<date-time>
必填
created_by
string | null
必填
enabled
boolean
必填
frequency
string | null
必填
last_error_at
string<date-time> | null
必填
last_error_message
string | null
必填
last_executed_at
string<date-time> | null
必填
name
string
必填
notify_on
enum<string>
必填
可用选项:
always,
failure,
never
org_id
string
必填
playbook
PlaybookInfo · object
必填
prompt
string
必填
scheduled_session_id
string
必填
updated_at
string<date-time>
必填
schedule_type
enum<string>
默认值:recurring
可用选项:
recurring,
one_time
scheduled_at
string<date-time> | null
slack_channel_id
string | null
slack_team_id
string | null