試跑與測試模式

取得 API 金鑰

POST /v1/posts?dry_run=true 會執行真實發布的各項檢查:各網絡的規則、已連結的帳號、媒體、日期和你的方案。它不會儲存任何內容,也不會送出任何內容。

就緒

當每個網絡都會接受該帖文時,回傳 200 和 status: "ready",並為每個目標給出將用於發布的帳號。

被拒絕

否則回傳 422 post_refused,每個原因對應一則詳細資料。每則詳細資料都會指出所屬網絡、它的 code,並說明該如何修正。

json
{
  "error": {
    "code": "post_refused",
    "message": "The post would not be published: x: the text is too long (300 characters, at most 280)",
    "details": [
      {
        "platform": "x",
        "code": "caption_too_long",
        "max": 280,
        "actual": 300,
        "message": "x: the text is too long (300 characters, at most 280)"
      }
    ],
    "docUrl": "https://www.sofia-post.com/developers/errors#post_refused"
  }
}

所有原因都列在錯誤中。

測試模式

以 test 模式建立的應用程式(sofia_test_at_… 權杖)可以讀取你真實的 Workspace,但絕不會寫入:它的帖文是模擬的,並依相同規則判斷,任何真實寫入都會回傳 403 live_mode_required。在設定 › API 中建立的金鑰和用戶端屬於 live;如需在不發布的情況下檢查,請使用試跑。