Which HTTP Status Code is the best to use for “Client requested a wrong format”, e.g. the client requested format=json and the data is only available as XML? I tend to use 406 but this refers to the Accept heders, whereas the format is given as parameter in the query string in my usecase.
Is 406 the right code here anyway?
Thanks
My advice is always to keep it simple. Send a 400 Bad Request and in the response body add a message indicating why the request was bad (ie format json not available).