Skip to main content

Searching Resources

Searching for resources allows you to read resources based on a specified criteria.

To perform a basic search, you can call the search method along with the criteria by which you want to search. This method will return a Bundle resource containing the search results.

observationsBundle = plasma.search("Observation", { "patient": patientId, "category": "laboratory" });

Search Parameters

The search criteria that are allowed for each resource can be defined by the FHIR server for which you are working and may differ from server to server. However, a good starting place is to find the resource on the official FHIR site and scroll to the "Search Parameters" section. This section will identify the search options for this resource along with instructions on how to use them.

Here is an example for the Observation resource: https://build.fhir.org/observation.html

Search Resources By Id

If you know the Id of a resource, it is recommended that you use the methods from the "Reading Resources" section. However, you can accomplish this with a search by passing in the Id as one of the search parameters. Note that the return type will still be an array.

observation = plasma.searchResource<r4.Observation>("Observation", { "_id": observationId });