Using the StructureDefinition's url:below modifier when searching #1649
-
I'm a bit of a newcomer to the Firely SDK so apologies if this has an obvious answer or not the right place to ask! I'd like to use the SDK to search for StructureDefinitions in the same way (or similar) to the code snippet below: SearchParams q = new SearchParams("url:below", "https://example.com");
q.Add("kind", "resource");
q.Count = 20;
Task<Bundle> bundleTask = _conformanceClient.SearchAsync<StructureDefinition>(q);
bundle = await bundleTask; I think I am not forming the url:below parameter correctly for the SDK though, as the bundle contains StructureDefinitions that are not filtered by that parameter, and more importantly it also contains an OperationOutcome error that states: 'Overall result: FAILURE (1 errors and 0 warnings)\r\n\r\n[ERROR] Parameter is not well formatted, expected 'parametername[:modifier]=value'. The parameter is stripped from the NextLink, SelfLink and LastLink properties in the bundle too. Could anyone tell me how I'd need to form that parameter? Is Search() even the correct method to use? So far I've tried URL encoding the URL value and using the string array method of specifying the search criteria. I don't think this is a bug, as it happens in the Java SDK too, more likely user error! A REST call using the browser with those parameters is OK and returns what I expect. I am using Nuget package HL7.Fhir.STU3 version 2.0.3. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
hi @ajerrison-manchester , thanks for using the Firely .NET SDK. What you are trying to do should work. I've created the following unit test and that succeeds: [TestMethod, TestCategory("IntegrationTest"), TestCategory("FhirClient")]
public async System.Threading.Tasks.Task Discussion1649Async()
{
using var client = new FhirClient("https://server.fire.ly/Administration/R3", settings: FhirClientSettings.CreateDefault());
SearchParams q = new SearchParams("url:below", "http://hl7.org/fhir/us/core/StructureDefinition/us-core");
q.Add("kind", "resource");
q.Count = 20;
var bundle = await client.SearchAsync<StructureDefinition>(q);
Assert.IsNotNull(bundle);
Assert.IsTrue(bundle.Entry.Count > 0);
} I use here our own Firely Fhir server: https://server.fire.ly and I use STU3, so that is why the Which Fhir server do you use? |
Beta Was this translation helpful? Give feedback.
hi @ajerrison-manchester , thanks for using the Firely .NET SDK.
What you are trying to do should work. I've created the following unit test and that succeeds: