Bluesky 身份的 PLC 歷史記錄
GET/tools/plc-history
來自 PLC 目錄的 did:plc 身份操作記錄,以時間軸呈現:建立、帳號代碼變更、伺服器(PDS)搬遷、簽署密鑰與輪換密鑰變更、作廢的操作、tombstone。也接受帳號代碼。一頁操作,由新到舊;可依要求提供原始操作。消耗 2 次呼叫。
參數
| 名稱 | 位置 | 類型 | 說明 |
|---|---|---|---|
| q (必填) | query | string | 一個 did:plc、帳號代碼或 bsky.app 個人檔案連結。 |
| limit | query | integer (1–100), default 50 | 每頁的操作數,由新到舊:1 到 100,預設為 50。 |
| page | query | integer (1–), default 1 | 操作的頁碼,從 1 開始。 |
| include_raw | query | boolean, default false | 為每項操作附上 PLC 目錄所發布的原貌(`operation`)。 |
回應
| 狀態碼 | 說明 | 內容 |
|---|---|---|
| 200 | 工具的回答,附上其頁面的標準 URL。 | ToolPlcHistory |
| 400 | 查詢參數無效(代碼 `bad_request`)。 | Error |
| 401 | 權杖不明、已過期或已撤銷(代碼 `unauthorized`)。沒有 `Authorization` 標頭時,工具會以匿名方式回答。 | Error |
| 404 | 找不到。在機械人的帳號代碼子網域上也會傳回此結果:API 僅在主站提供。 | Error |
| 429 | 已達速率限制:依 IP 計算 `toolsApi`(每分鐘 60 次)和 `toolsApiDaily`(每天 2,000 次),使用創作者權杖時依帳號計算,兩者皆為 10 倍。會分散發出多個請求的工具,消耗不只一次呼叫。 | Error |
| 500 | 未預期的錯誤。 | Error |
| 502 | 工具查詢的服務沒有回應(代碼 `upstream_error`)。 | Error |
範例
curl \
-G \
--data-urlencode "q=did:plc:z72i7hdynmk6r22z27h6tvur" \
-H "Authorization: Bearer $BLUESKY_BOT_TOKEN" \
https://bluesky.bot/api/v1/tools/plc-history結構描述
Error
| 欄位 | 類型 | 說明 |
|---|---|---|
| error (必填) | object | |
| error.code (必填) | string: "bad_request", "invalid_handle", "not_found", "rate_limited", "internal_error", "unauthorized", "forbidden", "conflict", "invalid_grant", "upstream_error", "insufficient_scope", "invalid_listing", "consent_required" | |
| error.message (必填) | string | |
| error.reason | string | 搭配 `invalid_handle`、`invalid_listing`、`conflict` 和 `forbidden`:例如 `reserved`、`taken`、`too_long`、`no_handle`、`suspended`。 |
| error.url | string, uri | 搭配 consent_required:開啓此控制台頁面以授權編輯個人檔案。 |
| error.field | string | 搭配 `invalid_listing`:遭拒絕的欄位。 |
| error.scope | string | 搭配 `insufficient_scope`:權杖缺少的範圍。 |
| error.parameter | string | 無效的查詢參數。 |
| error.retryAfterSeconds | integer (1–) | 搭配 `rate_limited`。 |
ToolPlcHistory
| 欄位 | 類型 | 說明 |
|---|---|---|
| tool (必填) | string = "plc-history" | 工具的 slug。 |
| url (必填) | string | 工具在 Bluesky.bot 上頁面的標準 URL。 |
| result (必填) | object | 工具的回答。 |
| result.did (必填) | string | 這份歷史記錄所屬的 DID。 |
| result.kind (必填) | string: "history", "too_long", "not_plc" | `history`;記錄超過 1 MB 時為 `too_long`;did:web 或其他方法沒有公開記錄,此時為 `not_plc`。 |
| result.summary (必填) | object | null | 身份概覽;除非 `kind` 為 `history`,否則為 null。 |
| result.truncated (必填) | boolean | 超過 1,000 項操作:只列出最新的 1,000 項。 |
| result.operations (必填) | object[] | 一頁操作,由新到舊。 |
| result.operations[].cid (必填) | string | 操作的 CID。 |
| result.operations[].createdAt (必填) | string | PLC 目錄收到它的時間。 |
| result.operations[].type (必填) | string: "plc_operation", "create", "plc_tombstone" | `plc_operation`、舊式的 `create`,或 `plc_tombstone`。 |
| result.operations[].nullified (必填) | boolean | 之後被優先順序更高的輪換密鑰覆蓋(72 小時內);目錄仍會保留它。 |
| result.operations[].events (必填) | object[] | 與前一項有效操作相比變更的內容。 |
| result.operations[].events[].kind (必填) | string: "created", "handle", "pds", "signing_key", "rotation_keys", "services", "other", "tombstone", "no_change" | `created`、`handle`、`pds`(移到另一台伺服器)、`signing_key`、`rotation_keys`、`services`(其他服務)、`other`(其他別名或驗證方法)、`tombstone` 或 `no_change`。 |
| result.operations[].events[].from (必填) | string | null | 變更前:帳號代碼、PDS 端點或簽署密鑰;不存在或不適用時為 null。 |
| result.operations[].events[].to (必填) | string | null | 變更後:帳號代碼、PDS 端點或簽署密鑰;不存在或不適用時為 null。 |
| result.operations[].events[].added (必填) | string[] | 新增的輪換密鑰。 |
| result.operations[].events[].removed (必填) | string[] | 移除的輪換密鑰。 |
| result.operations[].operation | object | PLC 目錄所發布的操作原貌,僅在使用 `include_raw` 時提供。 |
| result.page (必填) | integer | 傳回的操作頁。 |
| result.pages (必填) | integer | 在此 `limit` 下的操作頁數。 |
| result.notes (必填) | object[] | 值得留意的備註:輪換密鑰和伺服器在 24 小時內都變更時為 `keys_and_server`(可能是搬遷,也可能是遭到接管)。 |
| result.notes[].kind (必填) | string: "keys_and_server" | 備註的類型。 |
| result.notes[].at (必填) | string | 伺服器變更的時間。 |