_include, _revinclude, _with
Include associated resources
Syntax for the _include search parameter:
_include(:reverse|:iterate|:logical)=(source-type:)search-param:(:target-type)
Here search-param is a name of the search parameter with the type
reference
defined for source-type.This query can be interpreted in the following manner. For the source-type resources in the result include all target-type resources, which are referenced by the search-param. If you skip the source-type, it will be set to the resource-type you are searching for:
GET /Encounter?_include=subject:Patient
=> GET /Encounter?_include=Encounter:subject:Patient
target-type is optional for not chained includes and means all referenced resource-types:
GET /Encounter?_include=subject
=> GET /Encounter?_include=subject:*
For more explicit interpretation and for performance reason, client must provide target-type for chained includes!
You can include all resources referenced from the search result using *. This is considered bad practice because it's too implicit. This feature is only implemented for conformance with the FHIR specification. Please avoid using it!
_include=* could not be used as part of chained (rev)includes!
GET /Encounter?_include=*
Syntax for revinclude:
_revinclude(:reverse|:iterate|:logical)=(source-type:)search-param(:target-type)
Interpretation**:** include all source-type resources, which refer target-type resources by search-param in the result set.
If you provide
:logical
modifier, Aidbox will include logically referenced resources as well. Logical reference means reference with attribute type
set to resource-type and identifier
attribute set to one of identifier of referenced resource. Example:GET
PUT Patient
PUT Encounter
GET /Encounter?_include:logical=patient
GET /Encounter?_with=patient:logical
GET /Patient?_revinclude:logical=Encounter:patient:Patient
GET /Patient?_with=Encounter.patient:logical
PUT /Patient