Open natlibfi-arlehiko opened 7 years ago
I would suggest that we fix the issue by defining and returning the error types also in XML. I suppose that will break some client library then? Is it reasonable to expect changes to the client libraries?
To help fixing the client libraries, we could move the current behaviour under some new content-type (something like application/xml+json-errors or application/legacy or something) and then implement application/xml so that it always returns XML responses. That way the client libraries should only change the request content-type.
Yeah. Using a different content type for the old behaviour sounds reasonable. Setting that header on the client side will be a minor change in all known clients.
Endpoint /bib/\<id> returns data with content type application/xml but errors with content type application/json. The content type should always be the same for the same HTTP resource.
Possible solutions (All are breaking changes)
Serialization both to XML and JSON
Return both errors data and errors in the same format.
JSON payload
Return a JSON payload that contain data and/or errors. The data has to be JSON serialized, but can be parsed as XML directly: