Forum Discussion
45 minutes ago, Stuart Weenig said:Why not just his this endpoint?
/device/groups/{id}/devices
get immediate devices under group
Because I don't know where, in the group structure, the Exchange servers are located. For example, "Customer" could have "Location A" and "Location B" subgroups, each of which could have "Linux" and "Exchange" subgroups. Maybe they also have an Exchange server directly in the "Customer" folder. I could recursively search for subgroups, then for each one, use the endpoint you suggested, but that seems inefficient.
30 minutes ago, mnagel said:I was thinking of was that the filter is not valid -- you cannot match only on values. Well you can, but it is then detached from the property name and could match many properties. You need to match on name and value together.
filter=customProperties.name:PROPNAME,customProperties.value:PROPVALUE
The /device/groups idea is a good one if you are not matching on wildcards, like in this case (though you could use two passes to get an ID list, then iterate). We have found the sometimes that is necessary due to lack of endpoints (e.g., there is no direct way to map a device datasource instance ID back to the datasource ID), but if you can use one query to do your work you should try to do so.
This seems to work:
filter=systemProperties.name:"system.staticgroups",systemProperties.value~"CustomerName",systemProperties.name:"system.categories",systemProperties.value~"IISServer"
But what if I needed devices (in the CustomerName group) that had "category1" or "category" in system.categories? Both of the following filters returns zero results (in the portal right now, I am looking at one device that should be returned, but maybe there are more):
filter=systemProperties.name:"system.staticgroups",systemProperties.value~"CustomerName",systemProperties.name:"system.categories",systemProperties.value~"category1",systemProperties.name:"system.categories",systemProperties.value~"category2"
filter=systemProperties.name:"system.staticgroups",systemProperties.value~"CustomerName",systemProperties.name:"system.categories",systemProperties.value~"category1",systemProperties.value~"category2"
Incidentally, while thinking of another example, I found that this works to give me 32-bit Windows servers with 3.75GB of memory (across all groups):
filter=systemProperties.name:"system.systemtype",systemProperties.value~"x86-based PC",systemProperties.name:"system.sysinfo",systemProperties.value~"Windows",systemProperties.name:"system.totalphysicalmemory",systemProperties.value:"3.75GB"