1.3 Error and info messages

The Web API uses a consistent format for all error/warning and informational messages:

   "httpStatus" : "Forbidden",
   "message" : "You don't have the proper permissions to read objects of this type.",
   "httpStatusCode" : 403,
   "status" : "ERROR"

Here we can see from the message that the user tried to access a resource I did not have access to. It uses the http status code 403, the http status message forbidden and a descriptive message.

WebMessage properties
Name Description
httpStatus HTTP Status message for this response, see RFC 2616 (Section 10) for more information.
httpStatusCode HTTP Status code for this response, see RFC 2616 (Section 10) for more information.
status DHIS2 status, possible values are OK | WARNING | ERROR , where OK is means everything was successful, ERROR means that operation did not complete and WARNING means operation was partially successful, if there message contains a response property, please look there for more information.
message A user friendly message telling whether the operation was a success or not.
devMessage A more technical, developer-friendly message (not currently in use).
response Extension point for future extension to the WebMessage format. This will be documented when it starts being used.