FHIR Chat · FhirClient · dotnet

Stream: dotnet

Topic: FhirClient


view this post on Zulip Angelo Miguel Ferreira (Mar 16 2022 at 08:56):

Hi there everyone!
Sending a quick one - maybe I'm lucky enough and someone has passed through this recently and could help.
I am trying to know what is the exact URL query that is constructed behind the method "client.SearchAsync<Patient>(searchParams)"
Being client an instance of FhirClient
Any thoughts?

view this post on Zulip Josh Mandel (Mar 16 2022 at 14:22):

I expect there is a good and more direct answer to your question, but as a general approach: you can always use a local proxy to inspect and observe behavior. E.g. technique from https://willschenk.com/articles/2021/logging_with_an_http_proxy/

view this post on Zulip Gino Canessa (Mar 16 2022 at 16:30):

As Josh mentioned, if you are looking to understand one specific query it may be simplest to run it against something that will log the request for you. E.g., setup an HTTP server that does nothing but log the results - the query will fail on the client, but will show you what was requested.

If you are looking to understand in general how the SDK transforms search parameters, the source code is all online. The function you want is executeAsync in firely-net-sdk/src/Hl7.Fhir.Core/Rest/BaseFhirClient.cs. Here is a link to the function on the develop-r4 tree (current development for FHIR R4). The other 'main' file I think you would be interested in is firely-net-sdk/src/Hl7.Fhir.Core/Rest/SearchParamsExtensions.cs (link to develop-r4). This file shows some of the internal mappings for conversion of terms like OrderBy and LimitTo into the SearchParams equivalent. From those entry points, you should be able to navigate through everything.

Oh, one more entry point that may help (depending on what you are looking for) is looking at SearchParamTests.cs in the fhir-net-sdk/src/Hl7.Fhir.Core.Tests/Rest directory (develop-r4 branch link).

Hope this helps!


Last updated: Apr 12 2022 at 19:14 UTC