2

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?

jaco0646
  • 15,303
  • 7
  • 59
  • 83

1 Answers1

0

These sources imply that Content Negotiation should apply to error messages.

API Error CodesThe 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.

TwitterWhen the Twitter API returns error messages, it does so in your requested format.

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