To quote RFC2616:
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.
When a client queries your service, check what Accept*
headers it sent; if it doesn't match application/json
(or a wildcard, e.g. */*
), return this. The response should indicate "we only serve JSON here".
415 Unsupported Media Type
The server is refusing to service the
request because the entity of the
request is in a format not supported
by the requested resource for the
requested method.
Just returning 415 Unsupported Media Type
should be the minimum response for "the client has sent something that's not JSON, can't work with that"; not sure if there's a header to indicate "you need to send JSON"