Skip to main content

Posts

Showing posts from March 13, 2018

How to Create Appropriate API error messages

When an API request fails due to request errors or server errors, an error response message is returned in JSON format. An error response message is returned in JSON format even for endpoints that support other MIME types. The error response message includes error message itself, a description of the error, a unique error code for the endpoint, an HTTP response message, and an HTTP response code. The error response includes following fields: message : the error message details : a field for additional information, which may or may not be populated description : description of the specific error code : Unique error response code http_response : message : HTTP response message code : HTTP response status code For example, the following API request attempts to get information about a non-existent reference set that is called “test-set” https://<host_ip>/api/reference_data/sets/test_set An HTTP 404 response code and the following JSON error response ...