Hi guy's,
In Gateway we created an REST API.
When we consume this API with the query option ?$format=json and use the following HTTP Headers in the GET Method to get results in JSON format it works fine and we receive the data correct in JSON format:
Content-Type -> application/json
X-Requested-With -> XMLHttpRequest
Accept -> application/json
All http 2xx, 3xx and 4xx client errors that occur will be displayed correctly in JSON format (e.g. http 400 bad request, because wrong query options are added to the consuming API url):
{
"error": {
"code": "005056A509B11ED1B9BF94F386DD82E6",
"message": {
"lang": "en",
"value": "The Data Services Request could not be understood due to malformed syntax"
}
}
}
Only when a http 5xx internal server errors occur (system dump) the error information is displayed in XML format (e.g. system dump occors or an RFC destination is not reachable):
<error>
<message>
</message>
</error>
How to get a http 5xx error in JSON format?