I’m just in the initial phase of querying GPConnect Access Record HTML for integration into our systems, and I’m falling at the first hurdle.
I’ve looked though whatever documentation I can find (almost all of it seems to be outdated by many years), and I’ve cobbled something together, but I get errors back.
I have the following code (C#):
I’m using the Hl7.Fhir.R4 package from Firely which seems to be the recommended package for accessing the NHS FHIR APIs.
string nhsID = "9658218873";
HttpClient http = new();
var TraceID = Guid.NewGuid().ToString();
http.DefaultRequestHeaders.Add("Ssp-From", "200000000359");
http.DefaultRequestHeaders.Add("Ssp-To", "918999198993");
http.DefaultRequestHeaders.Add("Ssp-InteractionID", "urn:nhs:names:services:gpconnect:fhir:operation:gpc.getcarerecord");
http.DefaultRequestHeaders.Add("Ssp-TraceID", TraceID);
var client = new FhirClient(baseURL, http);
client.Settings = new FhirClientSettings { PreferredFormat = ResourceFormat.Json };
var parameters = new Parameters();
parameters.Add("patientNHSNumber", new Identifier("http://fhir.nhs.net/Id/nhs-number", nhsID));
parameters.Add("recordSection", new CodeableConcept("http://fhir.nhs.net/ValueSet/gpconnect-record-section-1", "SUM"));
var json = JsonConvert.SerializeObject(parameters);
var resource = await client.TypeOperationAsync<Patient>("gpc.getcarerecord", parameters);
I’ve got the various values from the samples found in the Postman scripts, and they work within Postman.
When I run that code I get the following exception back:
Operation was unsuccessful because of a client error (UnsupportedMediaType). OperationOutcome: Overall result: FAILURE (1 errors and 0 warnings) [ERROR] (no details)(further diagnostics: Unsupported content media type)
I’m tearing my hair out trying to figure out where I’m going wrong. I’ve been trying to read through the documentation, but it’s a complete rats nest of documents and so many dead end links that it’s almost impossible to extract any useful guidance.
Please, if anyone can help out I’d be very thankful.