Recommended API patterns.
Adoption of a common POST query syntax would allow the same software to, for example, POST a FHIR resource point-to-point to a dispensing system, POST a FHIR resource to a service like the Electronic Prescription Service (EPS), or POST a FHIR resource to a shared records service. A service like the EPS may require some additional data elements, but the mechanism of posting can be the same, using a different base URL technical end-point.
Adoption of a common GET query syntax would allow the same software to, for example, GET FHIR resources from a GP system or GET FHIR resources from shared records service. The query syntax can be the same, using a different base URL technical end-point.
POST Interactions
When POSTing a FHIR resource using a RESTful API use;
POST {fhir_server_base_url}/{resource}
For example;
POST https://myfhirserver.net/medicationrequest
with a Body
containing a single FHIR resource. Other resources referenced must be referenced with valid identifer
values to allow the FHIR server to locate those resources.
{ "resourceType": "MedicationRequest", "identifier": "a54219b8-f741-4c47-b662-e4f8dfa49ab6" // etc. }
When POSTing a FHIR Message use;
POST {fhir_server_base_url}/$process-message
with a Body
containing a FHIR Bundle within which is a FHIR MessageHeader resources and multiple FHIR resources;
{ "resourceType": "Bundle", "id": "0A1FD9EF-A3D5-4E95-84CD-552070A03083", "identifier": { "system": "https://tools.ietf.org/html/rfc4122", "value": "34470bbf-07cb-4b49-bef9-f958114f821f" }, "type": "message", "entry": [ { "fullUrl": "urn:uuid:0A1FD9EF-A3D5-4E95-84CD-552070A03083", "resource": { "resourceType": "MessageHeader", "id": "0A1FD9EF-A3D5-4E95-84CD-552070A03086", "eventCoding": { }, // etc. "sender": { }, // etc. "source": { }, // etc. "destination": { } // etc. } }, { "fullUrl": "urn:uuid:a54219b8-f741-4c47-b662-e4f8dfa49ab6", "resource": { "resourceType": "MedicationRequest", "identifier": "a54219b8-f741-4c47-b662-e4f8dfa49ab6" // etc. }
GET Interactions
To query a FHIR server for a specific resource by identifier
;
GET https://{fhir_server_base_url}/{resource}?identifier={value}
For example;
GET https://myfhirserver.net/MedicationRequest?identifier=a54219b8-f741-4c47-b662-e4f8dfa49ab6
To query a FHIR server for a specific resources for a given patient;
GET https://{fhir_server_base_url}/{resource}?patient.identifier=https://fhir.nhs.uk/Id/nhs-number|{NHS_Number}
For example;
GET https://myfhirserver.net/MedicationRequest?patient.identifier=https://fhir.nhs.uk/Id/nhs-number|123543254