Resource Result Set Filtering

Lgfapi offers the ability to apply filters to GET and HEAD requests in order to narrow down the final result set. This is done by adding query string filter parameters to the URI. Furthermore, lgfapi supports several built-in lookup functions to assist in common filtering tasks.

It is important to note that all entity data is automatically filtered by the user’s eligible facilities and companies. This prevents users from being able to access and/or change data outside of their assigned scope that same way that data is isolated in the UI or RF features. The difference with lgfapi is that users may access data from multiple eligible facilities and companies in a single request. In the UI and RF, this typically requires manually changing the user’s context.

The most basic format for a filter uses simply the exact operator (“=”): …/?field=value

This can be chained to apply multiple filters: …/?field1=value1&field2=value2

Lgfapi uses double underscore (“__”) notation in order to join multiple fields or functions in the query string filters. The double underscore is used to distinguish the field names when filtering on a related resource’s attributes or when applying a lookup function.

Applying a lookup function: …/?field__lookup=value

Filtering on a related resource: …/?relation_id__related_field=value

Applying a lookup function on a related resource: …/?relation_id__related_field__lookup=value