Thank you for your message and you interest in Europass.
More specifically:
- When Content-Type:application/xml => Error is always in XML
- When Content-Type:application/json => Error is always in JSON
- When Content-Type is set to something different than XML or JSON (e.g. Content-Type:application/pdf in the case of the /document/extraction endpoint) => Error is always XML
- When the Content-Type header is missing from the request => Error is always XML
This is a design decision, based on the rationale that the majority of our users would normally want to get back the error in the same format with the document being uploaded to the web service. We had considered the Accept header when we were developing the REST API, but eventually decided to not support it so as to keep things as simple as possible.
That said, could you please provide us with a few more details on why exactly you prefer to get back a JSON response even though your input file is in XML? (For example, you could have selected to use JSON for the input file too, so that you have to deal with one format only). This way, we can better assess your use case and perhaps reconsider some initial design decisions.
Thanks a lot,
Dimitris Zavaliadis
Team Europass