Error Handling

The API will always return sensible HTTP status code.

There are 2 types of API errors:

  • 400 series status codes for client issues
  • 500 series status codes for server issues.

Common HTTP Status codes returned on errors:

  • 400 Bad Request - search could not be processed or failed basic FHIR validation rules
  • 401 Not Authorized - authorization is required for the interaction that was attempted
  • 404 Not Found - resource type not supported, or not a FHIR end-point
  • 422 Unprocessable Entity - resource was rejected by the server because it "violated applicable FHIR profiles or server business rules"
  • 500 - Internal Server Error

Along with the Status Code the API will return an OperationOutcome resource as response containing details about the error. Here is an example of OperationOutcome object:

{
   "resourceType": "OperationOutcome",
   "issue": [
       {
"severity": "error",
           "code": "processing",
           "diagnostics": "Invalid request: The FHIR endpoint on this server does not know how to handle GET operation[Patient] with parameters [[wrong_parameter]]"
       }
   ]
}