Overview of the filtering syntax.
Filtering Overview
The Zylo Enterprise API provides robust filtering capabilities for GET requests, allowing you to refine data sets and retrieve only the data that is relevant to your needs. This feature supports filtering on individual fields as well as multiple fields in a single request.
Basic Filtering Syntax
To apply a filter, append query parameters to the endpoint URL in the following format:
/v2/applications?{fieldName}={filterValue}
Example
Filter applications by status:
/v2/applications?status=active
Multi-field Filtering
You can apply filters to multiple fields by separating them with an ampersand (&).
Example
Filter applications by multiple statuses and tags:
/v2/applications?status=active,expired&tags=security
Filter Types
Boolean Filters
Boolean fields can be filtered using the keywords true or false.
Examples
- Filter applications where
is_samlis true:
/v2/applications?is_saml=true
- Filter applications where
is_samlis false:
/v2/applications?is_saml=false
Number Filters
Number fields support comparative filtering operations: less than (lt), less than or equal to (lte), greater than (gt), and greater than or equal to (gte). You can define a range by combining these operations.
Examples
- Filter applications with
activity_thresholdgreater than 90:
/v2/applications?activity_threshold=90,gt
- Filter applications within a range (90 to 100):
/v2/applications?activity_threshold=90,gte,100,lte
Date Filters
Date fields require the format YYYY-MM-DD and support the same comparative operations as number filters.
Examples
- Filter applications created after January 1, 2024:
/v2/applications?created_at=2024-01-01,gt
- Filter applications created between January 1, 2024, and January 1, 2025:
/v2/applications?created_at=2024-01-01,gte,2025-01-01,lte
String and Array Filters
String and array fields can be filtered using the default syntax. Multiple values can be specified by separating them with commas.
Example
- Filter applications with statuses either
activeorexpired:
/v2/applications?status=active,expired
Negation
Negation is supported by prefixing the filter value with !. This returns results that do not match the provided values.
Example
- Filter applications where status is neither
activenorexpired:
/v2/applications?status=!,active,expired
Entire Array Filtering
By default when filtering an array field, the records will be returned that match any of the provided values. It is possible to specify a filter value that needs to match the entire array by wrapping the values in [ ]
Example
- Filter applications where it has both marketing and sales tags
/v2/applications?tags=[marketing,sales]
Entire Array Filtering with Negation
Entire array filtering can be combined with negation filters.
Example
- Filter applications where it does not have both marketing and sales tags
/v2/applications?tags=!,[marketing,sales]
Nested Filtering
Some resources have nested fields within an object. These fields can be filtered on by using the same filtering syntax as above, but the field itself requires a different syntax (see below).
Example
- Filter applications where custom field is_new is true and custom field start_date is created after January 1, 2024:
/v2/applications?custom_fields[is_new]=true&custom_fields[start_date]=2024-01-01,gt
Note: It is not possible to combine positive and negative filters for the same field in a single request.
This filtering functionality equips developers with precise control over data retrieval from the Zylo Enterprise API, enhancing the efficiency and specificity of their API interactions.
Filtering Activity History Records
The after and before properties for an Activity History record are objects that contain the auditable fields for an application. These fields are filterable similar to how Applications can be filtered by Custom Fields.
Available Properties
| Name | Type |
|---|---|
| account_number | text |
| activity_threshold | number |
| app_label | text |
| app_owner_user | object |
| business_goals | text |
| business_owner_user | object |
| business_unit | text |
| category | text |
| holds_pii | boolean |
| it_owner_user | object |
| it_supported | boolean |
| launch_url | text |
| next_action | text |
| sso_enforced | boolean |
| status | text |
| subcategory | text |
| tags | text |
| true_up | boolean |
| note_text | text |
| value | text |
| is_active | boolean |
User Objects
The three available owner object properties (app_owner_user, business_owner_user, and it_owner_user) contain two nested properties; id and email.
Filtering by After or Before Fields
Below is a table describing how each field type can be filtered on:
| Type | Example |
|---|---|
boolean | ?after[bool_field]=true |
number | ?after[number_field]=1,gte,5,lte |
text | ?before[text_field]=engineering |
User Objects
To filter results to a specific owner then the dot notation can be used:
?after[app_owner_user.id]=4136cd0b-d90b-4af7-b485-5d1ded8db252
The above example would return activites where the app_owner_user was set to the user with the corresponding id.
?before[it_owner_user.email][email protected]
The above example would return activities where the it_owner_user was the user with the corresponding email before the it_owner_user was set to another user.