Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTTP status code for unaccepted Content-Type in request

For certain resources, my RESTful server only accepts PUT and POST requests with JSON objects as the content body, thus requiring a Content-Type of application/json instead of application/x-www-form-urlencoded or multipart/form-data or anything else.

Malformed JSON (or lack thereof) returns a 400 with the error message taken directly from the exception raised by the JSON parser, for debugging purposes.

Which HTTP error code means that the client sent a request with an unacceptable Content-Type, even if the server could technically parse the request content?

like image 882
Jordan Avatar asked Aug 15 '12 17:08

Jordan


People also ask

What is a 309 status code?

Status codes 309 through 399 are currently unassigned.

What is a 299 status code?

HTTP response codes 200 – 299 are bearers of good news: the request has been accepted, a new request has been created, or a certain problem was solved.

What is Status 204 no content?

The HTTP 204 No Content success status response code indicates that a request has succeeded, but that the client doesn't need to navigate away from its current page. This might be used, for example, when implementing "save and continue editing" functionality for a wiki site.

What does the HTTP status code 401 indicate?

The HyperText Transfer Protocol (HTTP) 401 Unauthorized response status code indicates that the client request has not been completed because it lacks valid authentication credentials for the requested resource.


1 Answers

It could be 415 Unsupported Media Type according to this list: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.4.16.

like image 162
William Durand Avatar answered Sep 22 '22 23:09

William Durand