Reputation: 653
My HTTP/Rest API has a resource endpoint that can handle "application/json" and "text/csv" response body formats which are specified via the "Accept" header on the request.
In case of error, like an HTTP 400, 500 response etc., i wonder what response body format should be used for returning error information. If used with application/json
, it pretty obvious the error information must be in JSON format. But what format to use in case of text/csv
, or any other more "exotic" mime types ?
Upvotes: 1
Views: 1535
Reputation: 99851
A HTTP server is free to disregard the Accept
header if none of the formats are available.
Given that there's not really a 'standard' CSV error response, I would default to application/problem+json
, text/html
or maybe even text/plain
.
Upvotes: 1