Closed wilsonchenbhs closed 2 years ago
A Bundle.link.url is of type 'uri', so it has to follow uri syntax and cannot be a relative reference. This means that the application returning the Bundle has to make sure it includes the correct details for a client to use. See also http://hl7.org/fhir/http.html#paging for this.
@mbaltus a .NET Uri can be relative, using UriKind we can specify whether the URI string is a relative URI, absolute URI, or is indeterminate.
In terms of the FHIR spec, it does not explicitly make it clear it has to be absolute url:
Yes, you are correct of course, URIs can be relative. My mistake. However, the FHIR specification mentions this in relation to paging and the links in the Bundle:
The links are opaque to the client, have no dictated structure, and only the server understands them. The client must use the server supplied links in order to traverse the pages.
So in this case, I would not expect the FhirClient to have to do any work to use a paging link.
Ok, in that case, I guess we will have to build the absolute url. Thanks!
Following the sample found in https://docs.fire.ly/projects/Firely-NET-SDK/client/paging.html , if we return the links (FirstLink/NextLink/PreviousLink/LastLink) as relative path, it would throw the following exception:
But, if we return the absolute url, it would be fine. However, it's hard for us to return the absolute url because the app can run:
I know we can add the base path to the app settings and concatenate it before returning the above links, but it's clumsy as we already have the base url passed into FhirClient. Wouldn't it be easier the FhirClient checks if it is not absolute url, then add the base url to it?