Healthcode APIs use the FHIR OperationOutcome resource as the API response in the following circumstances:
- when a RESTful interaction or operation fails
- as a response on a validation operation to provide information about the outcome
- as a response when the message has not been processed correctly
- optionally, as a response when an operation is successful e.g. DELETE operation response
Below is an example of a typical OperationOutcome resource returned by Slot Search API when the date-from search parameter has an incorrect date format or value.
{
"resourceType":"OperationOutcome",
"issue":[
{
"severity":"error",
"code":"value",
"details":{
"coding":[
{
"system":"URL",
"code":"MSG_DATE_FORMAT",
"display":"Invalid date format"
}
]
},
"diagnostics":"date-from :Unparseable date: "2021-05-",
"location":[
"Appointment"
],
"expression":[
]
}
]
}
Where,
Field | Type | Field Description |
---|---|---|
issue | BackboneElement | This is the block holding the error information |
severity | String | Severity indicates the level of the issue (error / fatal / information). Severity of type “information” indicates that the returned code is not an error code. |
code | String | Code describes the type of error or area within the application where the error occurred. |
location | String | This field indicates the part of the FHIR resource or path of the field where the processing error has occurred. |
details | CodeableConcept | This field holds information about the code and a short description of the nature of the issue. |
details.coding.code | String | Error code in case of API error or information code returned by the API |
details.coding.display | String | Details or information about the code returned by the API |
diagnostics | String | The Diagnostics field holds detailed information about the success message, error or exception that occurred within the application. |
Where the severity is fatal or error, the APIs return HTTP status code in the 400 range to indicate the error scenario. And where the severity is information, the APIs return return HTTP status code in the 200 range where the operation itself has succeeded (for example, the requested resource has been successfully deleted).