The iHub adopts a standard approach to error handling. Refer to section 7 of the DPC API Technical Data and Documentation standards for full details on error handling.
It is expected that Standard API's error handling and responses align with JSON:API best practices and conventions and use the format recommended in the JSON:API specification. Please see:
Standard APIs should use the status code of an HTTP response to message and inform clients of their request’s result. Refer to the API specification for full details of the HTTP status codes that client's are expected to implement.
When posting digital reports to a Standard API, the iHub implements a retry policy with an exponential back off for failed requests.
The iHub will resend failed requests up to 6 times. The platform will increase the time between each request exponentially. If the iHub is unable to get a success response from the Standard API after 6 requests, the digital report will be emailed to the force.
This is designed to increase the interface's reliability and prevent excessive requests being directed to a client server.
Links to media attachments will be contained within the Standard Data Modelled payload and as such are not subject to a separate retry policy.
Standard APIs must provide specific error messages with a clear business meaning. It is expected that APIs will return two levels of information:
- HTTP error codes and messages in the header
- JSON object in the response body with additional details that can help consumers determine how to handle the error.
Sufficient information should be provided to establish between the following two types of errors:
- Business Error: An error expected by the business domain. This may include a validation not being satisfied, a required field not being sent, or a record not being found.
- System Error: These types of errors are not expected. System errors may occur when a database connection fails, an upstream service returns a server error, or a code error is present.