API 參考

帖文與留言

列出本帳號帖文

只列出目前登入 TikTok 帳號嘅帖文;其他渠道回傳 501 unsupported_by_provider。limit 預設 20,範圍 1–50;next_cursor 原樣傳回。歸屬或分頁核實未完成屬於可重試失敗,唔代表不存在。保留渠道錯誤分類,其他讀取失敗回傳 502 list_posts_failed(39002)。

GEThttps://api.unifyport.ai/v1/accounts/{account_id}/posts

支援渠道

TikTok

呼叫前準備

在伺服器端使用資源所屬工作區的 X-Api-Key,執行範例前替換所有預留位置。

參數從哪裡取得
account_id
從建立或查詢帳號的回應取得 data.id。帳號屬於 X-Api-Key 對應的工作區。 攞帳號

請求參數

請求標頭

X-Api-Key
string必填

工作區 API Key,工作區會由呢個標頭解析得出嚟。

路徑參數

account_id
string必填

用嚟識別嗰條 accounts 路由嘅 ID。

查詢參數

cursor
string

原樣傳回上一頁嘅 next_cursor;首次請求唔傳,唔接受空字串。

minLength: 1

limit
integer

每頁數量係 1–50,預設 20。

minimum: 1 · maximum: 50

請求內容

呢個介面唔需要 JSON 請求內容。

如何理解結果

依本介面的回應欄位與 HTTP 狀態判斷結果,再透過相關操作選擇下一步。

回應 200 OK

{
  "request_id": "<REQUEST_ID>",
  "data": {
    "items": [
      {
        "id": "7500000000000000101"
      }
    ],
    "has_more": false
  }
}

回應內容

id
string

渠道識別碼,保留非空白字串原值,唔好轉做數字。

minLength: 1 · pattern: \S

text
string

可靠取得時保留原文,包括空字串;未知就省略。

author
object

可用時提供嘅作者資料。

id
string

渠道識別碼,保留非空白字串原值,唔好轉做數字。

minLength: 1 · pattern: \S

display_name
string

可靠取得時保留原文,包括空字串;未知就省略。

avatar_url
string

可靠取得嘅非空頭像 URL;未知就省略。

minLength: 1

created_at
string

可靠取得嘅帖文建立時間,RFC3339 UTC;未知就省略。

format: date-time

has_more
boolean

係咪仲有下一頁。

next_cursor
string

不透明游標,只喺 has_more=true 時回傳;下一頁原樣傳回,末頁省略。

minLength: 1

回應

200

200 OK

請求成功,回應內容嘅例子如上。

400

請求錯誤

請求內容、路徑或者參數無效。

401

未授權

X-Api-Key 請求標頭缺少或者無效。

403

禁止存取

請求已識別,但唔允許執行呢個操作。

404

搵唔到資源

搵唔到請求嘅資源;請結合 error.code 同目前操作核對。

409

衝突

目前操作同現有嘅渠道帳號或者資源衝突。

501

渠道未實作

所選渠道未實作呢個操作。

502

上游閘道錯誤

渠道轉接器或者上游渠道未能完成呢個操作。

失敗後如何處理

檢查 HTTP 狀態和 error.code/numeric_code,保留 request_id。依原因修正參數、繼續授權或檢查狀態。重試傳送及寫入前確認上次結果,避免重複操作。 錯誤碼參考

請按目前操作一併讀取 HTTP 狀態、error.code 同 error.numeric_code。數字碼以字串處理。保留 request_id 排查;佢唔係冪等鍵或任務識別碼。

invalid_request · 10000 · 400

檢查 JSON 請求內容與必填欄位。

處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。

示意 JSON;message 會隨實際原因變化 · 400 · 10000
{
  "request_id": "req_example",
  "error": {
    "code": "invalid_request",
    "numeric_code": "10000",
    "message": "Invalid request parameters"
  }
}
invalid_target_workspace · 11003 · 400

工作區覆寫目標為空或格式無效。請移除覆寫請求標頭,改用目標工作區所屬嘅 API Key。

觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。

處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。

示意 JSON;message 會隨實際原因變化 · 400 · 11003
{
  "request_id": "req_example",
  "error": {
    "code": "invalid_target_workspace",
    "numeric_code": "11003",
    "message": "Invalid target workspace"
  }
}
provider_invalid_request · 30001 · 400

檢查渠道專屬欄位及格式。

處理與重試: 按目前操作同渠道條件修正參數後再請求。重複提交相同嘅無效請求唔會解決錯誤。

示意 JSON;message 會隨實際原因變化 · 400 · 30001
{
  "request_id": "req_example",
  "error": {
    "code": "provider_invalid_request",
    "numeric_code": "30001",
    "message": "Provider rejected the request"
  }
}
invalid_api_key · 11001 · 401

檢查 API Key 是否正確且已啟用。

處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。

示意 JSON;message 會隨實際原因變化 · 401 · 11001
{
  "request_id": "req_example",
  "error": {
    "code": "invalid_api_key",
    "numeric_code": "11001",
    "message": "Invalid API key"
  }
}
missing_api_key · 11000 · 401

請加入 X-Api-Key 請求標頭。

處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。

範例 · 401 · 11000
{
  "request_id": "req_xxx",
  "error": {
    "code": "missing_api_key",
    "numeric_code": "11000",
    "message": "Missing X-Api-Key header"
  }
}
workspace_override_forbidden · 11002 · 403

請求嘗試使用呢個 API Key 無權使用嘅工作區覆寫。請移除覆寫請求標頭,改用目標工作區所屬嘅 API Key。

觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。

處理與重試: 保留 request_id 同結構化錯誤碼,先排查目前操作,再決定下一步。

示意 JSON;message 會隨實際原因變化 · 403 · 11002
{
  "request_id": "req_example",
  "error": {
    "code": "workspace_override_forbidden",
    "numeric_code": "11002",
    "message": "Workspace override is not allowed"
  }
}
account_not_found · 20020 · 404

核對 account_id,並使用帳號所屬工作區的 X-Api-Key。此工作區下未找到的帳號無法使用目前 Key 存取。

處理與重試: 核對目標識別碼、資源歸屬同目前工作區。唔好將已確認缺少或無法存取嘅目標當成暫時服務故障自動重試。

示意 JSON;message 會隨實際原因變化 · 404 · 20020
{
  "request_id": "req_example",
  "error": {
    "code": "account_not_found",
    "numeric_code": "20020",
    "message": "Account not found"
  }
}
target_workspace_not_found · 11004 · 404

覆寫指定嘅工作區不存在或不可用。請核對工作區歸屬,移除覆寫請求標頭並使用目標工作區 API Key;重複請求唔會增加存取權限。

觸發條件: 適用於帶有 X-Workspace-Id 工作區覆寫請求標頭嘅請求。

處理與重試: 核對目標識別碼、資源歸屬同目前工作區。唔好將已確認缺少或無法存取嘅目標當成暫時服務故障自動重試。

示意 JSON;message 會隨實際原因變化 · 404 · 11004
{
  "request_id": "req_example",
  "error": {
    "code": "target_workspace_not_found",
    "numeric_code": "11004",
    "message": "Target workspace not found"
  }
}
account_binding_not_found · 30006 · 409

帳戶尚無有效的渠道連線綁定,請檢查帳戶狀態。

處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。

示意 JSON;message 會隨實際原因變化 · 409 · 30006
{
  "request_id": "req_example",
  "error": {
    "code": "account_binding_not_found",
    "numeric_code": "30006",
    "message": "Account is not bound to an available server"
  }
}
provider_not_ready · 30009 · 409

連線尚未就緒,請檢查授權及 runtime_status 後再決定是否重試。

處理與重試: 查詢授權及運行狀態,再按目標狀態同渠道支援選擇刷新、啟動或重連。連線問題本身唔證明已登出;執行依賴連線嘅業務操作前確認 running。

示意 JSON;message 會隨實際原因變化 · 409 · 30009
{
  "request_id": "req_example",
  "error": {
    "code": "provider_not_ready",
    "numeric_code": "30009",
    "message": "Provider client is not ready"
  }
}
unsupported_by_provider · 30003 · 501

渠道不支援此操作,請選擇能力表中支援的操作。

處理與重試: 選擇文件列為支援嘅渠道同動作。重複請求唔會增加能力或開通內測權限。

範例 · 501 · 30003
{
  "request_id": "req_xxx",
  "error": {
    "code": "unsupported_by_provider",
    "numeric_code": "30003",
    "message": "Operation not supported by this provider"
  }
}
list_posts_failed · 39002 · 502

列出本帳號帖文:服務未能產生有效嘅查詢結果。

處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。

示意 JSON;message 會隨實際原因變化 · 502 · 39002
{
  "request_id": "req_example",
  "error": {
    "code": "list_posts_failed",
    "numeric_code": "39002",
    "message": "Failed to list posts"
  }
}
provider_unavailable · 30002 · 502

渠道服務暫時無法使用,請檢查狀態或稍後再試;重試寫入操作前先確認上次結果。

處理與重試: 保留 request_id,核對目標識別碼同帳號存取範圍。查明原因後再試查詢;查詢失敗唔代表結果為空或資源不存在。

範例 · 502 · 30002
{
  "request_id": "req_example_provider_unavailable",
  "error": {
    "code": "provider_unavailable",
    "numeric_code": "30002",
    "message": "Provider service unavailable"
  }
}