Filters
Filtering allows you to narrow API results using specific conditions. You can filter resources by one or more attributes using query parameters that start with filter
.
This feature supports both simple and complex queries, including combining multiple conditions and using arrays.
Important
Filters are supported on any endpoint that responds with a resource collection.
Filter by a single attribute
Use a single filter parameter to retrieve resources matching a specific value.
In this example, cities are filtered by their country.id
and returns only cities within the specified country:
http
GET /v3/cities?filter%5Bcountry.id%5D=72f22218-ab1f-4933-a74d-a6467f3f6cb0 HTTP/1.1
Host: api.didww.com
Accept: application/vnd.api+json
curl
curl -i -X GET 'https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=72f22218-ab1f-4933-a74d-a6467f3f6cb0' -H "Accept: application/vnd.api+json"
Filter by multiple attributes
You can combine multiple filter parameters to refine results further.
In this example, cities are filtered by both country.id
and region.id
, and returns only cities that match both conditions:
http
GET /v3/cities?filter%5Bcountry.id%5D=72f22218-ab1f-4933-a74d-a6467f3f6cb0&filter%5Bregion.id%5D=0800cac6-a0eb-4d58-8284-e5207b65a91b HTTP/1.1
Host: api.didww.com
Accept: application/vnd.api+json
curl
curl -i -X GET 'https://api.didww.com/v3/cities?filter%5Bcountry.id%5D=72f22218-ab1f-4933-a74d-a6467f3f6cb0&filter%5Bregion.id%5D=0800cac6-a0eb-4d58-8284-e5207b65a91b' -H "Accept: application/vnd.api+json"
Filter by arrays
You can use arrays in filters by separating values with commas.
For example, to filter DIDs that support specified features such as voice, voice_out, t38, sms, sms_out:
filter[features]=voice,voice_out,t38,sms,sms_out
Important
Do not provide the same filter multiple times (e.g., filter[features]=voice&filter[features]=sms
). Instead, use a single filter with comma-separated values.