Stream: dotnet
Topic: Operations and SearchParams
David Boss (Jun 10 2019 at 20:39):
Hello, I am looking to call a FHIR server that has a custom operation and the url looks something like this: POST [base]/Composition/$custom-operation-name
I am using the STU3 client and can't seem to find any where to tell the client to call this custom operation off the Composition resource.
Can anyone point me in the right direction?
Thanks,
David
David Boss (Jun 10 2019 at 21:32):
So I figured it out. Client.Operation(uri, "custom-operation-name, list of parameters)
the uri must include the name of the resource. The operation name must not contain the $.
Brian Postlethwaite (Jun 10 2019 at 23:10):
There are several overrides on the client
Brian Postlethwaite (Jun 10 2019 at 23:13):
Are you at dev days?
Brian Postlethwaite (Jun 10 2019 at 23:17):
client.TypeOperation<Patient>(...)
InstanceOperation(...)
David Boss (Jun 11 2019 at 14:34):
Wish I was, but unfortunately not.
But to follow up. Is there a way to use Client.Operation() with SearchParams. I have a custom operation like this:
GET [base]/Composition/$operation-name?filter=hello
David Boss (Jun 11 2019 at 20:58):
@Brian Postlethwaite Thanks for your answer. I ultimately decided to go with OperationAsync. Do you know how I might add a search param to an Operation call? None of the overloads take in a SearchParams object for a query string.
Michele Mottini (Jun 11 2019 at 22:20):
You use Parameters - add to it parameter named 'filter' with value 'hello' (of the appropriate type - FhirString if it is a simple string)
Michele Mottini (Jun 11 2019 at 22:21):
Or you sue Get and compose the request URL in your code
David Boss (Jun 13 2019 at 20:27):
Thanks @Michele Mottini I am going to ask the Server guys to change the queyString to be parameter based
Michele Mottini (Jun 14 2019 at 02:15):
Mhh, that's not what I meant. FHIR operations should always be callable with a POST of a Parameters resource. If all the parameters can be represented as string and the operation does not affect the server state the operation can be called also with a GET (see http://hl7.org/fhir/operations.html#executing) - and so this is how it should be implemented by the server guys
Michele Mottini (Jun 14 2019 at 02:17):
When using the client you call the Operation() methods passing the parameters as a Parameter resource - this by default generates a POST, but passing the useGet
argument set to true it generates a GET
Last updated: Apr 12 2022 at 19:14 UTC