Querying Resources

This page outlines best practices for querying resources efficiently and effectively using the Halaxy API

Basic Query Parameters

All resources include the following filters and query parameters to fetch the desired subset of data required.

Parameter

Usage

Examples

_id

Search by ID or IDs

Search a single ID Patient?_id=1

Search multiple IDs at once Patient?_id=1,2,3,4,5

_lastUpdated

Search by most recent time of modification

Find all patients updated on a single day
Patient?_lastUpdated=2025-02-11

Find all patients updated after a certain date
Patient?_lastUpdated=gt2025-01-01

Find all patients between a date range
Patient?_lastUpdated=gte2024-01-01T00:00:00Z&_lastUpdated=lte2025-01-01T23:59:59Z

_summary

Return a subset of the resource

Must contain one of the following values:

true : Return a limited subset of elements from the resource
false : Return all parts of the resource/s
text : Return only the text, id and meta elements, and only top-level mandatory elements
data : Remove the text element
count : Return only a count of matching resources without returning actual matches

Sample format: Patient?_summary=false

Learn more

_total

Return the total number of resources that match the search parameters

Only none and accurate are supported.

Tip: Adding ?_total=none will improve performance on large datasets

Learn more

_include

Return one or more related resources in the return bundle

Include the patient resource with the appointment
Appointment?_include=Appointment:patient

iterate

Return a related resource to an included resource

Return the practitioner resource with the included practitioner role resource from the appointment search
Appointment?_include=Appointment:patient&_include=Appointment:practitioner-role&_include:iterate=PractitionerRole:practitioner

_sort

Return the resource in a specific order

Sort patient names in ascending order
Patient?_sort=name

Sort patient names in descending order
Patient?_sort=-name

Applies to string, number, integer, date, or date-time values

Common Query Parameter Types

String

ParameterUsageDescription
[base]/Patient?given=eveSearch start of a stringAny patients with a name containing a given part with "eve" at the start of the name. This would include patients with the given name "Eve", "Evelyn".
[base]/Patient?given:contains=eveSearch part of a stringAny patients with a name with a given part containing "eve" at any position. This would include patients with the given name "Eve", "Evelyn", and also "Severine".
[base]/Patient?given:exact=EveSearch exact stringAny patients with a name with a given part that is exactly "Eve". This would not include patients with the given name "eve" or "EVE".

Number

ParameterUsage
[parameter]=100Search values that equal 100 to 3 significant figures precision. This includes the range [99.5 ... 100.5)
[parameter]=100.00Search values that equal 100 to 5 significant figures precision. The includes the range [99.995 ... 100.005)
[parameter]=1e2Search values that equal 100 to 1 significant figures precision. The includes the range [95 ... 105)
[parameter]=lt100Search values that are less than exactly 100
[parameter]=le100Search values that are less or equal to exactly 100
[parameter]=gt100Search values that are greater than exactly 100
[parameter]=ge100Search values that are greater or equal to exactly 100
[parameter]=ne100Search values that are not equal to 100

Date/ Date Time

Parameter

Usage

Examples

[parameter]=eq2013-01-14

Return records that fall within the specified date

  • 2013-01-14T00:00 matches
  • 2013-01-14T10:00 matches
  • 2013-01-15T00:00 does not match (not in the range)

[parameter]=ne2013-01-14

Return records that are outside of the specified date

  • 2013-01-15T00:00 matches - it's not in the range
  • 2013-01-14T00:00 does not match - it's in the range
  • 2013-01-14T10:00 does not match - it's in the range

[parameter]=lt2013-01-14T10:00

Return records that are older than the specified date

  • 2013-01-14 matches, because it includes the part of 14-Jan 2013 before 10am

[parameter]=gt2013-01-14T10:00

Return records that are newer than the specified date

  • 2013-01-14 matches, because it includes the part of 14-Jan 2013 after 10am

[parameter]=ge2013-03-14

Return records from the specified date and onwards

  • "From 21-Jan 2013 onwards" is included because that period may include times after 14-Mar 2013

[parameter]=le2013-03-14

Return records from the specified date and earlier

  • "From 21-Jan 2013 onwards" is included because that period may include times before 14-Mar 2013

References

Parameter

Description

Examples

[parameter]=[id]

The logical [id] of a resource using a local reference (i.e. a relative reference)

Find patients managed by Practitioner with a specific ID

Patient?generalPractitioner=Practitioner/PR-12345

[parameter]=[type]/[id]

The logical [id] of a resource of a specified type using a local reference (i.e. a relative reference), for when the reference can point to different types of resources (e.g. Observation.subject

Note: Some resources (such asPractitioner, PractitionerRole or Organization) may require a prefix to the ID.

Find patients managed by either one of the practitioners

Patient?generalPractitioner=Practitioner/PR-12345,Practitioner/PR-67890

Find patients that are managed by both practitioners

Patient?generalPractitioner=Practitioner/PR-12345&generalPractitioner=Practitioner/PR-67890

[parameter]=[url]

Where the [url] is an absolute URL - a reference to a resource by its absolute location, or by it's canonical URL

Find patients are managed by a specific practitioner

Patient?generalPractitioner=https://au-api.halaxy.com/main/PractitionerRole/PR-123456

Token

Parameter

Description

[parameter]=[code]

The value of [code] matches a Coding.code or Identifier.value irrespective of the value of the system property

Find all patients where status is active Patient?status=active

Pagination Parameters

Parameter

Type

Description

page

integer

The page number of the search results to return

_count

integer

The number of results to return on a single page, not including resources added from include statements

pagination

boolean

Defines whether to disable pagination for the route
Note: Requests will timeout after 30 seconds if the request is too large.