Error responses
If the useJsonErrorResponses
attribute on the
zosconnect_zosConnectManager
configuration element is not set, or set to true, all error responses from the
IBM® z/OS® Connect runtime are returned in JSON format.
For more information on the attribute, see zosconnect_zosConnectManager in the Reference section. If the attribute is set to false, the error responses are a mixture of JSON and plain text, depending on the error case encountered.
If an error occurs while processing a request, an appropriate HTTP status code and the following
JSON will be returned:
{
"errorMessage": "{message}",
"errorDetails": "{details}"
}
Note:
errorDetails
is optional and will only be returned for some error scenarios.- Special characters
<>'"
and&
are encoded with HTML entity encoding inerrorMessage
anderrorDetails
. - Service providers might use a proprietary error response format, so the format described above cannot be guaranteed when invoking an API or service.
For example:
A GET request to
/zosConnect/services/doesNotExist
, would return a HTTP status
code of 404 and JSON
body:
{
"errorMessage": "BAQR0431W: Service doesNotExist is not available."
}
The
following message is also written to the message
log:BAQR0403W: Service doesNotExist specified under URL http://server:1234/zosConnect/services/doesNotExist is not available.
A POST request to
/zosConnect/services/myService
with content-type set to
application/json
but an invalid body of: notJson
would return a
HTTP status code of 400 Bad Request and the following JSON
body:
{
"errorMessage": "BAQR0417W: The request payload could not be parsed.
A JSON object format payload is expected. Error: Unexpected identifier 'notjson' on line 1, column 7."
}