tool::http-status-detail
415 Unsupported Media Type
The media type of the request is not supported.
ステータスコード
415
名前
Unsupported Media Type
カテゴリ
4xx詳細説明
HTTP 415 Unsupported Media Typeは、サーバーがリクエストボディのメディアタイプをサポートしていないためリクエストを拒否する際に発生します。Content-Typeヘッダーが誤って設定されているか、サーバーが特定の形式のみ許可する場合に現れます。API開発でJSONを期待するエンドポイントにform-dataを送信するケースが典型的な例です。
主な原因
- ▸application/jsonが必要なのにtext/plainで送信した場合
- ▸ファイルアップロードエンドポイントにJSONを送信(multipart/form-dataが必要)
- ▸XMLを期待するサーバーにJSONを送信した場合
- ▸AcceptヘッダーとContent-Typeヘッダーの不一致
解決方法
- 1.APIドキュメントを確認して正しいContent-Typeヘッダーを設定してください
- 2.JSONデータ送信時: Content-Type: application/json
- 3.ファイルアップロード時: Content-Type: multipart/form-data
- 4.レスポンスボディでサポートされているメディアタイプを確認してください
関連HTTPヘッダー
Content-TypeAcceptレスポンス例
HTTP/1.1 415 Unsupported Media Type
Content-Type: application/json
{"error":"unsupported_media_type","message":"Content-Type must be application/json","supported":["application/json"]}関連ステータスコード
400Bad RequestThe server could not understand the request due to invalid syntax.→401UnauthorizedAuthentication is required and has failed or not been provided.→402Payment RequiredReserved for future use; some services use it for payment walls.→403ForbiddenThe server refuses to fulfill the request (authenticated but unauthorized).→404Not FoundThe requested resource could not be found.→
ad · 300×250
// related tools