Filtering devices by tags using API

Hi,
I’m trying to find out how to query all devices from an application by its tags.
I did not find anything in the API.

As an example I want to create 2 queries to the API:
#1: give me all devices having tag: “XYZ” with value “true”
#2: give me all devices NOT having tag “XYZ”

Thanks
Fritz

Hi,
at least for #1 I found the solution:
result = await resin.models.device.getAll({
$filter: {
device_tag: {
$any: {
$alias: ‘unmanaged’,
$expr: {
unmanaged: {
tag_key: “XYZ”,
value: “true”
}
}
}
}
}
});

But for #2 I’m not able to find a solution…
Help appreciated.

Thanks
Fritz

I’ve been reliably informed that $not on the entire filter object should do what you want.

For the benefit of any future audience I’ve had the pinejs-client tests recommended to me as a good resource for finding out the capabilities of our API query language.