跳转到主要内容
POST
/
schedule
/
create
创建值班表
curl --request POST \
  --url 'https://api.flashcat.cloud/schedule/create?app_key=' \
  --header 'Content-Type: application/json' \
  --data '
{
  "schedule_name": "Production On-Call",
  "description": "Primary on-call rotation for the production team",
  "team_id": 4291079133131,
  "layers": [
    {
      "layer_name": "Layer 1",
      "name": "Layer 1",
      "mode": 0,
      "weight": 0,
      "hidden": 0,
      "groups": [
        {
          "group_name": "A",
          "name": "A",
          "members": [
            {
              "role_id": 0,
              "person_ids": [
                2451002751131
              ]
            }
          ],
          "start": 0,
          "end": 0
        },
        {
          "group_name": "B",
          "name": "B",
          "members": [
            {
              "role_id": 0,
              "person_ids": [
                2476123212131
              ]
            }
          ],
          "start": 0,
          "end": 0
        }
      ],
      "rotation_unit": "day",
      "rotation_value": 1,
      "rotation_duration": 86400,
      "handoff_time": 0,
      "enable_time": 1712000000,
      "expire_time": 0,
      "restrict_mode": 0,
      "restrict_start": 0,
      "restrict_end": 0,
      "restrict_periods": [],
      "day_mask": {
        "repeat": [
          1,
          2,
          3,
          4,
          5
        ]
      },
      "fair_rotation": false,
      "mask_continuous_enabled": false
    }
  ],
  "notify": {
    "advance_in_time": 300,
    "fixed_time": null,
    "by": {
      "follow_preference": true,
      "personal_channels": null
    },
    "webhooks": null
  }
}
'
{
  "request_id": "01HK8XQE3Z7JM2NTFQ5YJ8P9R4",
  "data": {
    "schedule_id": 6294534917601
  }
}

限制说明

项目说明
速率限制每个账户 1,000 次/分钟50 次/秒
权限要求无 —— 持有有效的 app_key 即可调用

授权

app_key
string
query
必填

在 Flashduty 控制台 账户 → APP Key 中签发的 app_key。调用任何公开 API 时都必须携带。它等同于所属账户的身份凭证,请妥善保管。

请求体

application/json

值班表创建/更新/预览共用的请求体,结构与值班表详情一致,此处仅列出常用字段。更新时需要 schedule_id;预览时 start、end 必填。

schedule_id
integer<int64>

值班表 ID,更新时必填。

schedule_name
string

值班表显示名称,最长 40 字符。

Maximum string length: 40
name
string

旧版名称字段,当 schedule_name 为空时使用。

Maximum string length: 40
description
string

值班表描述,最长 500 字符。

Maximum string length: 500
team_id
integer<int64>

所属团队 ID。

layers
object[]

轮转分层。

notify
object

值班表的通知配置。

start
integer<int64>

预览窗口开始时间(Unix 秒,10 位),/schedule/preview 必填。

end
integer<int64>

预览窗口结束时间(Unix 秒,10 位),/schedule/preview 必填,且距 start 不超过 45 天。

响应

成功

成功响应结构。2xx 响应中 request_id 标识本次调用(同时出现在 Flashcat-Request-Id 响应头中),data 为接口业务 payload。失败响应使用不同结构,参见 ErrorResponse

request_id
string
必填

本次请求的唯一 ID,也会在 Flashcat-Request-Id 响应头中返回。反馈问题时请一并附上。

示例:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object
必填

创建值班表后返回的 ID 响应。