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,

FieldTypeField Description
issueBackboneElementThis is the block holding the error information
severityStringSeverity indicates the level of the issue (error / fatal / information). Severity of type “information” indicates that the returned code is not an error code.
codeStringCode describes the type of error or area within the application where the error occurred.
locationStringThis field indicates the part of the FHIR resource or path of the field where the processing error has occurred.
detailsCodeableConceptThis field holds information about the code and a short description of the nature of the issue.
details.coding.codeStringError code in case of API error or information code returned by the API
details.coding.displayStringDetails or information about the code returned by the API
diagnosticsStringThe 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).