Generic Search
Search a string across several text fields at once with the search parameter.
Sometimes you want to find an entity by a string without knowing which field it lives in. Because URL query parameters can't express an OR across fields, the Platform API provides a single search parameter that matches against several text fields at once:
labelnamedescriptionusernamefirstNamelastName
Add search=<string> to any list endpoint:
# Find any device or variable referencing "vaccine"
curl -X GET 'https://api.surfact.com/api/v2.0/devices/?search=vaccine' \
-H 'X-Auth-Token: your_token_here'{
"count": 1,
"next": null,
"previous": null,
"results": [
{
"label": "vaccine-box-09",
"name": "Vaccine Box 09",
"description": "Insulated pharma shipper"
}
]
}Refining the match
search can be combined with a match modifier for finer control:
| Modifier | Behaviour |
|---|---|
iexact | Case-insensitive exact match |
contains / icontains | Substring match (case-insensitive variant) |
startswith / istartswith | Prefix match |
endswith / iendswith | Suffix match |
# Devices whose searchable fields start with "reefer"
curl -X GET 'https://api.surfact.com/api/v2.0/devices/?search__istartswith=reefer' \
-H 'X-Auth-Token: your_token_here'
Search vs. filterUse Generic Search when you want one term matched across many fields (great for a UI search box). Use Field Filters when you need to target a specific attribute precisely.
Updated 3 months ago
Did this page help you?