Closed plavjanik closed 5 years ago
Original documentation (taken from https://docops.ca.com/x/r9SVH):
The response is to be in a JSON format and media type value is application/json
. The name of the fields is to use camelCase
. If the request is processed without any errors and warnings, then the response format is to be either a JSON object or JSON array. If the request is processed with an error or warning, then the response is to follow the JSON format as in the following code:
{
"messages": [
{
"messageType": "ERROR",
"messageNumber": "CSR0001",
"messageContent": "Pet with id '404' is not found"
}
]
}
The above response contains a messages section. The messages array is a place for application (or service) status and message descriptions to complement and enhance the basic HTTP status codes that are returned in the HTTP status line.
Follow the principle that message key (for example org.zowe.sdk.apiml.serviceCertificateNotTrusted
) is for the code and message content (readable text) is for people. When an error occurs, The HTTP status codes are returned. Provide more details within this message structure. The meaning of the fields is (in order of importance):
ERROR
, WARNING
, INFO
, DEBUG
, or TRACE
tld.provider.service[.subservice].detail
. For example: org.zowe.sdk.apiml.serviceCertificateNotTrusted
. The purpose of this field is to enable UI to show a meaningful and localized error message. The message key is used instead of the message number as the number makes the code hard to read, and makes renumbering difficult and error-prone.
PetControllerExceptionHandler.java
which provides a recommended style)ApiMessage
class)