Filtering
You can narrow down Object List results by applying field filters as query parameters. Filters allow you to retrieve only the objects that match specific criteria.
Field Filters
Filter by exact field values by passing the field name and desired value as a query parameter:
?status_name=Connected
?is_oneoff=trueFor example, to retrieve only measurements with status 2 (Specified):
GET /api/v2/measurements/?status=2
Range Filters
For numeric and date fields, you can use lookup suffixes to filter by ranges:
| Suffix | Description | Example |
|---|---|---|
__gt | Greater than | id__gt=1000 |
__gte | Greater than or equal to | id__gte=1000 |
__lt | Less than | id__lt=2000 |
__lte | Less than or equal to | id__lte=2000 |
__in | Matches any value in a comma-separated list | asn_v4__in=3333,1234 |
For example, to retrieve objects with IDs between 1000 and 2000:
?id__gte=1000&id__lte=2000String Filters
For text fields, additional lookup suffixes are available:
| Suffix | Description | Example |
|---|---|---|
__contains | Field contains the given substring | description__contains=test |
__startswith | Field starts with the given string | description__startswith=DNS |
__endswith | Field ends with the given string | description__endswith=anchor |
Combining Filters
When you specify multiple filter parameters, they are combined with AND logic. All conditions must be true for an object to be included in the results:
?status=2&is_oneoff=true&protocol=4This returns only measurements that are status 2 and one-off and using IPv4.
Silent Ignore
Like other query parameters, unknown filter parameters are silently ignored by the API. If a filter does not seem to be working, verify that the field name and suffix are correct for the resource type you are querying.