I've used the
ca.uhn.fhir.rest.client.api
IGenericClient
(and its concrete)
for many years.. for the "well known" FHIR operations like
read
vread
search
update
create
https://hapifhir.io/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/rest/client/api/IGenericClient.htmlhttps://hapifhir.io/hapi-fhir/docs/client/examples.htmlPrimary Question:
*Is there any examples of how to code against the hapi-fhir client libraries.. for custom methods/operations.*
...
for example, a well known custom operation like
URL: [base]/Patient/$match
https://hl7.org/fhir/R4/patient-operation-match.htmlwhich is a 'form of a' search operation.
example REQUEST
POST /open/Patient/$match
[some headers]
{
"resourceType": "Parameters",
"id": "example",
"parameter": [
{
"name": "resource",
"resource": {
"resourceType": "Patient",
"identifier": [
{
"use": "usual",
"type": {
"coding": [
{
"system": "
http://hl7.org/fhir/v2/0203",
"code": "MR"
}
]
},
"system": "urn:oid:1.2.36.146.595.217.0.1",
"value": "12345"
}
],
and
https://hl7.org/fhir/us/davinci-hrex/2020Sep/Parameters-member-match-in.json.htmlPOST {{fhirurl}}/Patient/$member-match
example REQUEST:
{
"resourceType" : "Parameters",
"id" : "member-match-in",
"parameter" : [
{
"name" : "MemberPatient",
"resource" : {
"resourceType" : "Patient",
"id" : "1",
"identifier" : [
{
The thing here is that while the methods are defined against the "Patient" FHIR resource... the "input" is an array of "Parameters" objects.
But just for some variation:
https://www.hl7.org/fhir/activitydefinition-operation-apply.htmlURL: [base]/**ActivityDefinition**/$apply
URL: [base]/**ActivityDefinition**/[id]/$apply
this is a GET that returns a
<MedicationRequest xmlns="
http://hl7.org/fhir">
Aka, the FHIR-Resource that is a part of the request ("ActivityDefinition") in the above... the return type is not a single or bundle of ActivityDefinition(s), but a MedicationRequest.
Despite all the specific examples... the crux of the question is .. how would one .. .code a custom operation .. against or extending IGenericClient (?)