Search loading...

API Hub

Explore and Make use of Nationally Defined Messaging APIs

 

A019: Generate Patient Letter

Status: Beta

API URL

Base URL (Dev3): ‘https://api.dev3.ers.ncrs.nhs.uk/ers-api’

Method URL Authentication
POST /STU3/v1/ReferralRequest/[UBRN]/$ers.generatePatientLetter Session Token (Details)

Description

As a Referring Clinician (/Administrator) having created a referral I want to retrieve the patient’s letter So that the patient has all the necessary details to choose the clinic they want to attend and book an appointment

This endpoint is to be used as part of the Create Referral workflow.

Prerequisite Operations

A referral must exist and the user must legitimately have access to it. A letter can be re-printed multiple times, but the current API only supports the scenario of referrals that don’t have an appointment booked.

Request Operation

Request Header

Field Name Value
XAPI_ASID The “Accredited System ID” issued to the third party
HTTP_X_SESSION_KEY The session key generated by the Create Session endpoint (A001)
Accept ‘application/pdf`
Content-Type ‘application/fhir+json`

Request Body

This operation does not require a payload. The operation definition for this endpoint is available on the FHIR server: eRS-GeneratePatientLetter-Operation-1

Example Request Header
    EXAMPLE COMING SOON
  
Example Request Body
    N/A
  


Response

Success

HTTP Status code 200 (OK) is returned. The response body contains the binary stream of the just generated patient letter.

Example Response Body
    EXAMPLE BINARY STREAM
  


Failure

If an error occurs, the relating HTTP status code will be returned. Where status code 422 (Unprocessable Entity) is returned then an eRS-OperationOutcome-1 will be included in the body, as detailed below.

issue.details.code Description
INVALID_REQUEST_TYPE The UBRN provided exists in e-RS but does not correspond to a referral
INVALID_REQUEST_STATE The referral state is either incomplete or cancelled or the referral has a booked appointment or the referral has been superseded by an onward referral; or: the referral has a booking deferral or a triage deferral
NO_ACCESS_CODE The patient doesn’t have an access code/password to log onto the patient portal
NO_RELATIONSHIP The user does not have a suitable legitimate relationship with the referral

All content is available under the Open Government Licence v3.0, except where otherwise stated