稽核事件
稽核事件物件是一筆「誰在什麼時候改了什麼」的紀錄,只追加,不可修改或刪除。
共通錯誤見 錯誤。
端點
| 方法與路徑 | 中文名 | 所需權限 |
|---|---|---|
GET /v1/audit/events |
列出稽核事件 | read_audit |
稽核事件物件
| 欄位 | 型別 | 必填或可為 null | 用途 |
|---|---|---|---|
id |
字串 | 必填 | 事件識別碼 |
action |
字串 | 必填 | 動作名稱 |
app_id |
字串 | 必填 | 執行動作的應用程式識別碼 |
resource_type |
字串 | 可為 null | 被操作的資源型別,例如 blog_post |
resource_id |
字串 | 可為 null | 被操作的資源識別碼 |
request_id |
字串 | 可為 null | 當次請求的追蹤碼,對應回應標頭 X-Request-Id |
occurred_at |
字串 | 必填 | 事件發生時間 |
summary |
字串 | 可為 null | 事件的一句話摘要 |
由應用程式觸發的動作:blog.post.created、blog.post.updated、blog.post.published、blog.post.unpublished、blog.post.deleted、blog.category.created、media.image.uploaded、media.image.deleted、auth.denied、auth.scope_denied、resource.not_found、app.token.issued、app.token.revoked。
由平台觸發的動作,名稱以 tenant. 開頭:
tenant.probe_ok:平台完成商店資料檢查。tenant.schema_drift:平台偵測到商店資料結構變動。
GET/v1/audit/events
查詢參數:
since(字串,可省略)只回這個時間之後的事件,ISO 8601 且含時區action(字串,可省略)篩選動作名稱,須是上列名稱之一resource_id(字串,可省略)篩選資源識別碼,最多 64 字cursor(字串,可省略)上一頁的meta.next_cursor,原樣帶回limit(整數,可省略)每頁筆數,1 到 50,預設 20
data 依發生時間新到舊,meta.next_cursor 為 null 即最後一頁,meta.limit 是本次每頁筆數。
| 錯誤碼 | 狀態碼 | 處理動作 | 可重試 |
|---|---|---|---|
insufficient_scope |
403 | 改用帶 read_audit 的金鑰 |
否 |
validation_failed |
422 | 依 details 修正 action、since 或 limit |
否 |
rate_limited |
429 | 依 Retry-After 等待後重送 |
是 |