跳转到主要内容
POST
创建状态页事件

限制说明

使用说明

  • status 以及 updates 中的组件状态都必须与 type 匹配,且每个 component_id 都必须是该状态页上已有的组件。
  • updates 必须按 at_seconds 非递减排列。若 status 为 resolved 或 completed,所有受影响组件的最终状态都必须是 operational。
  • notify_subscribers 为 true 时,仅针对 updates 中最后一条更新通知订阅者一次。
  • 维护事件开启 auto_update_by_schedule 后,服务端会在 start_at_seconds 将其从 scheduled 切换为 ongoing,在 close_at_seconds 从 ongoing 切换为 completed,并把受影响组件恢复为 operational。
  • 传入 draft_id 可发布由 POST /status-page/draft/create 存储的草稿;草稿必须指向同一状态页和 type,且只能发布一次。
  • 每次调用都会记录到账户审计日志,请勿在请求字段中写入敏感信息。

授权

app_key
string
query
必填

在 Flashduty 控制台 我的 → APP Key 中创建的 APP Key。可通过 query 参数 app_key 或请求头 Fd-App-Key 传入。实际可访问范围是该 APP Key 的权限范围与创建者当前角色权限的交集,请妥善保管。

请求体

application/json

创建状态页故障或维护事件所需的参数。首条更新必须包含 component_changes 以声明受影响组件;回溯事件至少需要 2 条更新。

page_id
integer<int64>
必填

状态页 ID,可通过 GET /status-page/list 获取。

type
enum<string>
必填

事件类型:incident 故障,maintenance 计划维护。

可用选项:
incident,
maintenance
title
string
必填

事件标题,最多 255 个字符。

Maximum string length: 255
description
string
必填

事件描述(支持 Markdown),必填,不能为空。

status
enum<string>
必填

事件初始状态。故障事件支持 investigating/identified/monitoring/resolved;维护事件支持 scheduled/ongoing/completed。

可用选项:
investigating,
identified,
monitoring,
resolved,
scheduled,
ongoing,
completed
updates
object[]
必填

时间线更新,须按 at_seconds 非递减排列。至少需要一条更新,且至少一条包含 component_changes。即时事件通常传一条;复盘事件至少传两条。

Minimum array length: 1
start_at_seconds
integer<int64>

事件开始时间,Unix 时间戳(秒)。维护事件会将其保存为计划开始时间(开启 auto_update_by_schedule 时即切换为 ongoing 的时间);省略或为 0 时,以及故障事件,开始时间一律取第一条更新的 at_seconds。

responders
integer<int64>[]

事件负责成员的 ID 列表。

linked_changes
string[]

关联的事件 ID 列表(相关故障、发布等)。

close_at_seconds
integer<int64>

事件结束时间,Unix 时间戳(秒),必须大于或等于第一条更新的 at_seconds。维护事件为计划结束时间;开启 auto_update_by_schedule 时会在该时间切换为 completed,且必须在当前时间起 30 天内。复盘事件处于终态且未传此字段时,取最后一条更新的时间。

notify_subscribers
boolean

是否通知订阅者。创建时仅针对最后一条更新发送一次通知;之后发布的时间线更新在该值为 true 时也会通知。

auto_update_by_schedule
boolean

仅维护事件:根据计划窗口自动推进状态。

is_retrospective
boolean

将事件标记为复盘事件(事后补录的历史事件)。要求 updates 至少两条。

draft_id
string

随本次创建一并发布的草稿 ID,由 POST /status-page/draft/create 返回。草稿须处于待发布状态、指向本 page_id 和 type 且不带 change_id;事件创建成功后草稿标记为已发布。不发布草稿时省略。

响应

成功

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

request_id
string
必填

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

示例:

"01HK8XQE3Z7JM2NTFQ5YJ8P9R4"

data
object

创建状态页事件的结果。