FHIR Chat · Resource references · implementers

Stream: implementers

Topic: Resource references


view this post on Zulip Nadis Suraweera (Aug 12 2019 at 12:29):

Hi,
When a user GET a resource by ID it is possible to include references for other resources.
It works fine with just Ids as the reference.
Example:
Ex: partOf in Organization resource.

            <partOf>
                 <reference value="Organization/1347"></reference>
             </partOf>

But I am wondering whether will it be required to include the complete referenced Organization also in the same result than loading the referenced resource in an another REST invocation
Is it possible at all?
If Yes, how and can you please explain it since the GET by id return only a single resource and how does that possible to include the parent resource(partOf) also within the same result.

view this post on Zulip Kevin Mayfield (Aug 12 2019 at 13:00):

You could use https://www.hl7.org/fhir/search.html#include
I've not used the read form of GET \Organization\{id} instead I've done a search such as GET \Organization?_id={id}&_include=Organization.partof .. the partof asks for the referenced Organization to be included in the search results.

view this post on Zulip Nadis Suraweera (Aug 12 2019 at 13:46):

Thank you very much @Kevin Mayfield
if it is a search, it should be possible to include referenced resources in the same result since the result is a Bundle/List. But i am wondering how we can do it for just a one resource? may be that is not possible to do that for a single resource?

view this post on Zulip John Moehrke (Aug 12 2019 at 13:47):

as you point out a GET search by _id is functionally just like a GET of the resource by ID, but a GET search can also use the _include and other modifiers. Note your server must support these things like _include, not all do.

view this post on Zulip Kevin Mayfield (Aug 12 2019 at 14:06):

As John as pointed out, you use the _id to specify the resource.

view this post on Zulip Nadis Suraweera (Aug 12 2019 at 15:27):

Got it and Thank you very much @John Moehrke and @Kevin Mayfield


Last updated: Apr 12 2022 at 19:14 UTC