Add a filter
argument to an empty query string to apply a filter. A single filter is specified as a KEY=VALUE.
An example of a filter query is shown below.
?query=\&filter=online%3D1
?query=
is an empty query that needs to be added before the filter.
\&filter=
is where the filter begins.
online
is the key that we filter for.
%3D
is an encoded equals sign =
.
1
is a binary value that we filter for, "true". This indicates that we want to see the devices that are online. If a 0
was specified we would filter for offline devices.
http GET https://apps.dataplicity.com/devices/?query=\&filter=online%3D1 'Authorization: Token 123456789abcdefghijklmnopqrstuvwxyzqwer'
curl --header "Content-Type: application/json" -H "Authorization: Token 123456789abcdefghijklmnopqrstuvwxyzqwer" --request GET https://apps.dataplicity.com/devices/?query=\&filter=online%3D1
Equals sign '=' encoding
Note that the filter argument must be percent encoded
%3D
to pass the equals symbol (and potentially characters in VALUE).
Query and a Filter combination
By default to use a Filter we have to combine it with a query. Combining multiple search options is explained here.