Version: This is an old version of the NRL API specification.
For the current version of the specification please visit the NRL API page.
Connection Code
Connection code Examples
Important: This site is under active development by NHS Digital and is intended to provide all the technical resources you need to successfully develop APIs. This project is being developed using an agile methodology so iterative updates to content will be added on a regular basis.
Warning: This site is provided for information only and is intended for those engaged with NHS Digital on the development of APIs. It is advised not to develop against these specifications until a formal announcement has been made.
Common NRLS Connection Code Examples
Connecting with C#
The following code samples are taken from the NRLS Demonstrator application which has both Consumer and Provider client implementations built in. More information about the design solution can be found
on the NRLS Demonstrator Wiki
To start we create a base command request model that defines the type of request we want to make (GET, POST or DELETE) and then sets the required attributes.
Within the model the full url to the NRLS API is constructed including appending any required parameter values passed in.
At this point we also generate our JWT using the ASID, ODS Code and User Role Profile ID values that are passed in.
Once we have our command request model we call the FhirConnector service to start the actual call to the NRLS.
We first build our HTTP message. At this point we also add in our NRLS specific headers that are held in our base request model and add in our DocumentReference model (http content) if we are performing a create (POST).
Next we make the call to the NRLS API and then parse the response.
Here we are expecting either a FHIR Bundle or a FHIR OperationOutcome both of which inherit from a FHIR Resource.
There is a check here to see if we have a success type HTTP response code. If not then we immediately raise an error.