web services - HTTP 406 and 415 error codes - Stack Overflow
55 406 Not Acceptable The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. 406 happens when the server cannot respond with the accept-header specified in the request.
Both 406 and 200 are unsuitable for this situation: 406 is meant for content negotiation, when the server cannot send a representation of a particular resource with the media type indicated in the Accept header of the request. 200 must be used when the operation has succeeded, what's not the case. You could probably go for the generic 400 to express a bad request or go for 403 to indicate that ...
406 Not Acceptable The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request. So, your request accept header is application/json and your controller is not able to return that. This happens when the correct HTTPMessageConverter can not be found to satisfy the ...
406 is used when the client requests a response in an unsupported content type (in your case, anything other than JSON) using the Accept header. 415 on the other hand is used when the client POSTs or PUTs data in an unsupported content type. In a nutshell: use 406 if can't output in the expected format and use 415 if you don't support the input format. See RFC 2616 for their definitions: 406 ...