Hi there,
I can’t figure out what I am doing wrong.
I have 3 devices.
I have added them to a group:
But when I call the group info via the API (open for now testing):
https://sunderland-test.onlosant.com/api/groups
I can’t see the devices:
{
“groupTags”: {
“Type”: “Sub-contractor”
},
“name”: “Nomad Installer”,
“applicationId”: “62c591186fd751ddcf341521”,
“creationDate”: “2022-08-01T17:17:17.529Z”,
“lastUpdated”: “2022-08-01T21:48:36.278Z”,
“deviceQueryJson”: “{\n "$and": [\n {\n "deviceClass": {\n "$eq": "standalone"\n }\n }\n ]\n}”,
“experienceGroupId”: “62e80a9dfe41b38464654221”,
“id”: “62e80a9dfe41b38464654221”,
“parentId”: null,
“deviceIds”: [
],
“deviceTags”: [
],
“experienceEndpointIds”: [
],
“experienceUserIds”: [
“62e84133a3bfaddbd7a73e18”
]
}
It must be something silly but I can’t figure it out.
Hello @Paolo_Proxy,
It looks like you’re querying just the metadata for a group, likely using the Group: Get Node?
If you want to get the devices that are associated with a group, you’ll have to use the Device: Get Node. One of the built-in query types is Find by Experience Group ID.
Hope that helps!
Hello yes this is what I am using:
According to the example the device ids should appear:
{
"data": {
"query": {
"name": "myGroup"
...
},
"groupResult": {
"name": "myGroup",
"description": "I'm a group",
"creationDate": "2017-03-30T00:18:23.902Z",
"lastUpdated": "2017-03-30T00:18:59.019Z",
"applicationId": "58dc4ec29e8df60001fbea01",
"groupTags": [{
"key": "myKey", "value": "val"
}],
"deviceIds": [ "58dc4ec29e8df60001fbea02" ],
"parentId": null
}
},
...
}
but in my case the field deviceIds is empty.
Could this be a bug?
What you’re seeing is the configuration of the group. Devices can be associated to a group in three ways:
- By specifying one or more device IDs
- By specifying one or more device tags
- Using an advanced query
You used an advanced query, which is why the device IDs and tag properties are blank.
To get the collection of devices associated with a group, you have to use the Device: Get Node.
1 Like
Ah, I got it now, it wasn’t clear in the documentation. I can see now that the fields are populated as I change the query.