If a client sends an Accept header of application/xml, should the body of any error message (e.g. 500) also be xml? Or does the Accept header only apply to 200-level responses?
Asked
Active
Viewed 192 times
1 Answers
0
These sources imply that Content Negotiation should apply to error messages.
API Error Codes – The payload format can change according to what MIME types your API uses: you might reply with a JSON payload including your specific error code and an optional error message, or with an XML body with similar information.
Twitter – When the Twitter API returns error messages, it does so in your requested format.

jaco0646
- 15,303
- 7
- 59
- 83
-
1Twitter has changed their API. It now states, "_Twitter API error messages are returned in JSON format._" – jaco0646 Nov 30 '19 at 17:11