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?
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:
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
Because with the above statement I am getting following error:
“display”: “Unsupported Service”,
How should I read Patient resource output from FHIR Client?
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.