Skip to content

Errors and exceptions

All resources communicate a success or error condition with the standard HTTP status code of an API request. Below is an overview of all the supported codes, along with suggestions that fix potential issues.

As a general rule:

  • Codes in the 2xx range indicate success.
  • Codes in the 4xx range indicate an error that failed given the information provided (e.g., a required parameter was omitted, a request wasn't found, etc.).
  • Codes in the 5xx range indicate an error with Kodjin FHIR Server API server.

All 4xx errors that could be handled programmatically (e.g., resource not found) include an OperationOutcome that explains the error reported.

Error Description
200 - OK Everything worked as expected.
401 - Unauthorized No valid Bearer token provided or enough scopes for requested operation.
404 - Not Found The requested resource doesn't exist or wrong url route.
422 - Unprocessable Entity Outcome for processing errors.
500 - Server Error Something went wrong on server API.

Additional error information

A response with a code in the 4xx or 5xx may contain additional information in the form of an FHIR OperationOutcome. Examples of OperationOutcome:

Examples of OperationOutcome

{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "value",
            "expression": [
                "http.Accept"
            ],
            "details": {
                "text": "Server does not support given format. Acceptable formats are: application/fhir+json, text/json, application/json"
            }
        }
    ]
}
{
    "resourceType": "OperationOutcome",
    "issue": [
        {
            "severity": "error",
            "code": "invalid",
            "expression": [
                "Observation.id"
            ],
            "details": {
                "text": "Observation with such id already exists"
            }
        }
    ]
}