PDS FHIR- Not able to retrieve Capabilility Statement resource from the metadata url of sandbox env. Instead getting "Bundle" resource type

Hi team,

I am writing my own Java FHIR client which consumes your sandbox env URL from the client itself using JAVA HAPI FHIR libraries.

So while invoking the sandbox URL from FHIR client, it is executing internally first to fetch metadata which in turns returning “Bundle” resource instead of returning the “Capaibility Statements” . That’s is what stated in an error message as well. Please refer to the below mentioned errror details.

Hence looking for support to check if there is any issue with the sandbox version of that API while returning the response if you call the following url:
Shouldn’t it return a resource other than Bundle?

Error details:

ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException: Failed to retrieve the server metadata statement during client initialization.
URL used was https://sandbox.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient/9000000009/metadata

ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException: Failed to parse response from server when performing GET to URL https://sandbox.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient/9000000009/metadata -
ca.uhn.fhir.parser.DataFormatException: Incorrect resource type found, expected “CapabilityStatement” but found “Bundle”

Also May I know if this FHIR API can b e written in such a way that it can be executed with the following way by using following FHIR client statement through read operation:

IGenericClient client=ctxt.newRestfulGenericClient(url)
Patient p=(org.hl7.fhir.r4.model.Patient) client.read().resource(“Patient”).withId(id).execute();

where url: https://int.api.service.nhs.uk/personal-demographics/FHIR/R4/Patient/9449304424
id= 9449304424

Because with the above statement I am getting following error:

“issue”: [
“code”: “processing”,
“details”: {
“coding”: [
“display”: “Unsupported Service”,
“system”: “https://fhir.nhs.uk/R4/CodeSystem/Spine-ErrorOrWarningCode”,
“version”: “1”
“severity”: “error”
“resourceType”: “OperationOutcome”

How should I read Patient resource output from FHIR Client?

Please help.

Hi Gaurav,
The PDS FHIR API does not currently support the Capability Statement, see Personal Demographics Service - FHIR API - NHS Digital

If your client library requires that then it will not be possible to use it with the API.

However, possible someone from the PDS team @HAWDON, Alex (NHS DIGITAL) could possible add more context to your second question

There is a feature request from 2021 that PDS API supports the capabilities interaction. You can add a vote for it!

The Sandbox environment is a mock, so (AFAIK) if there is no configured response to your specific request a default Bundle response is provided.

NHS API Management team let me know that there is currently no intention to change the API behaviour to conform to the FHIR standard by supporting the capabilities interaction.