NHSDigital-OperationOutcome
| Conformance url | FHIR Module | Maturity Level |
|---|---|---|
| https://fhir.nhs.uk/StructureDefinition/NHSDigital-OperationOutcome | Implementation Support | normative |
Conformance Rules
| key | human | severity | expression |
|---|---|---|---|
| nhsd-errrorcode | An NHS Digital error or warning code is required | error | (severity = 'information') or ((severity != 'information') and details.empty().not()) |
API Error or Warning Codes
| code | display | definition |
|---|---|---|
| ACCESS_DENIED | Access has been denied to process this request | Although authenticated - the system or user does not have permission for a particular request. Recommend using HTTP Status Code 403 |
| ACCESS_DENIED_LEVEL | Access has been denied because you need higher level permissions | The request requires higher pemission levels than the authentication provided. For example NHS login has three main levels of P0, P5 and P9 - and the request held a P0 level, instead of P9. Recommend using HTTP Status Code 403 |
| ACCESS_TOKEN_EXPIRED | Access token has expired | Obtain a new access token - the provided access token has expired and is no longer valid, access tokens only have a short life time. Recommend using HTTP Status Code 401 |
| ACCESS_TOKEN_INVALID | Authorization header not formatted correctly | The bearer token could not be retrieved from the Authorization header, format should be 'Bearer INSERT-ACCESS-TOKEN'. Recommend using HTTP Status Code 401 |
| ACCESS_TOKEN_MISSING | Authorization header not sent | The access token must be passed in the Authorization header. The format should be 'Bearer INSERT-ACCESS-TOKEN'. Recommend using HTTP Status Code 400 |
| TIMEOUT | Request has timed out | The request has not responded in the timeout period, retry the request. Recommend using HTTP Status Code 408 |
| TOO_MANY_REQUESTS | Your connection has exceeded the rate limit | APIs have different rate limits - and your request has been rejected. Rate limits can be per application (connection) or per API. A detailed reason will be returned in the diagnoistics field. Wait a short period and re-try, ideally with an exponential back-off policy. Recommend using HTTP Status Code 429 |
| METHOD_NOT_ALLOWED | Method not allowed | The request method (verb) is not permitted on this endpoint. Recommend using HTTP Status Code 405 |
| SERVICE_UNAVAILABLE | Service unavailable - could be temporary | There has been a processing failure in the request chain. This could be tranisent failure for a single request, a temporary service issue or maintenance window. Re-send the request after the time specified in the Retry-After header. Normally maps to HTTP Status Code 503 |
| SERVICE_ERROR | Service failure or unexpected error | There has been server or service problem and it could be limited to this one request. Re-send the request after a short period of time. Normally maps to HTTP Status Code 500 |
| RESOURCE_NOT_FOUND | Resource not found | The URL did not point to an existing resource. This could be a simple incorrect url path, or for some REST APIs this can equate to a person or prescription not existing in that API. Recommend using HTTP Status Code 404 |
| MISSING_HEADER | A required header is missing | Inform the caller which required header is missing in the request. Some APIs will return a list of missing headers, others will return the first one. If a list is returned, there will be one issue per error. Recommend using HTTP Status Code 400 |
| VALIDATION_ERROR | A paremeter or value has resulted in a validation error | Returns which parameter or value was incorrect, and why. Some APIs will return a list of errors, others will return the first one. If a list is returned, there will be one issue per error. Recommend using HTTP Status Code 400 |
| MISSING_VALUE | A required value is missing | Inform the caller which value is missing value in the request. Recommend using HTTP Status Code 400 |
| NOT_ACCEPTABLE | Compatible content was not available | The request content string did not result in a matching content type that could be returned. If an API version was requested and it is invalid the message should make that clear. Recommend using HTTP Status Code 406 |
Example HL7 FHIR Validation Error
{
},
{
"diagnostics": "This element does not match any known slice defined in the profile https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient",
"Patient.identifier[1]",
"Line 1, Col 651"
]
},
{
{
}
]
},
"diagnostics": "Patient.gender: minimum required = 1, but only found 0 (from https://fhir.nhs.uk/StructureDefinition/NHSDigital-Patient)",
"Patient",
"Line 1, Col 37"
]
}
]
}
Example Data Business Rule Error
{
},
{
{
}
]
},
"/data/attributes/firstName"
]
}
]
}