HTTP 409 Conflict vs 415 Unsupported Media Type
Both HTTP 409 (Conflict) and 415 (Unsupported Media Type) belong to the 4xx Client Error category. 409 indicates that the request conflicts with the current state of the server. Often due to concurrent modification or business rule violations. Meanwhile, 415 means that the server refuses to accept the request because the Content-Type is not supported.
Description
The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.
When You See It
When trying to create a resource that already exists, or updating a resource that was modified by another request.
How to Fix
Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency.
Description
The server refuses to accept the request because the Content-Type is not supported.
When You See It
When sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
How to Fix
Set the correct Content-Type header matching the data format you're sending.
Key Differences
HTTP 409: The request conflicts with the current state of the server. Often due to concurrent modification or business rule violations.
HTTP 415: The server refuses to accept the request because the Content-Type is not supported.
You encounter 409 when when trying to create a resource that already exists, or updating a resource that was modified by another request.
You encounter 415 when when sending JSON to an endpoint that only accepts XML, or missing the Content-Type header.
When to Use Which
For 409 (Conflict): Refresh the resource state, resolve conflicts, and retry. Use ETags for optimistic concurrency. For 415 (Unsupported Media Type): Set the correct Content-Type header matching the data format you're sending.