> ## Documentation Index
> Fetch the complete documentation index at: https://ayrshare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# 如何修復 400 Bad Request 錯誤 | Ayrshare API 文件

> 了解 Ayrshare API 為何會回傳 Bad Request（400）錯誤、如何找出遺失或無效的參數，以及如何修正請求後重新發送。

如果你收到 HTML 格式的「Bad Request」回應而非 JSON，可能是 POST 主體中的參數不是有效的 JSON。

例如，若你傳送下列無效 JSON:

```javascript theme={"system"}
{
    "post": "A "great" post"
    "platforms: ["twitter"]
}
```

會回傳「Bad Request」。上述程式碼有三個問題：`post` 後遺漏逗號、貼文文字中有一組未跳脫的 " 引號，以及 `platform` 缺少結尾引號。正確的 JSON 應為:

```javascript theme={"system"}
{
    "post": "A \"great\" post",
    "platforms": ["twitter"]
}
```

你可以將 JSON POST 至下列 URL 來驗證。請務必將 Content-Type 設為 `text/plain`。

我們建議在 [Postman](/testing/postman) 中嘗試呼叫，它能協助修正 JSON 格式。更多資訊請見下一節。

## 驗證 JSON

你可以使用線上 JSON 檢查工具，例如 [https://jsonlint.com/](https://jsonlint.com/)，或使用 [Postman](/testing/postman) 進行驗證。

也可以使用我們的 `/validate/json` 端點:

<Card title="validate" icon="link" href="/apis/validate/overview" horizontal />
