Mosh

REST API endpoint device/groups/{id}/devices

Recommended Posts

We have a regional (Americas, EMEA, APAC) hierarchy in our Resources structure, and would like to be able to query via the API the total number of resources at a group level. 

Currently the API only returns items if the group has direct child resources, but if the group is there purely for taxonomy, then it returns no items.

We would like to be able to call an endpoint similar to /device/groups/{id}/devices which would return a total count of resources for the group, including all sub-groups.

Our use case is cross charging the regions for LogicMonitor costs, and for this we need to be able to automate the counting up of resource items for each region.  Basically we want to be able to get the same count we currently see in a resource group's tooltip, but via the API.

Share this post


Link to post
Share on other sites

Just a word of caution -- we found long ago that using groups for taxonomy creates massive security problems if you also want to grant different users access to functional groups (e.g., SQL admins to SQL servers).  With RBAC as it is, if a device is in two or more such groups, you cannot give access that way without giving access to all groups the device is in (this is apparently not considered a bug).  There really needs to be an option to mark a group as a security group to avoid this.  In the meantime, we have moved from static groups almost entirely to dynamic groups.  Our biggest problem before was this one -- using location-based groups to organize devices and to avoid setting the location string many times.  Now we use custom propertysources to set a location property value to define a dynamic location group, and that group gets the location string. 

As far as your issue, I assume you could recurse to get the data, but definitely there should be a way to do this in one shot, just like inherited properties.

Share this post


Link to post
Share on other sites

Hi @Mosh - The total number of resources (including those in sub-groups) should be returned in the group object information - i.e. GET /device/groups/ID. This is actually what the tooltip in the UI is pulling from. Have you tried this yet?

Share this post


Link to post
Share on other sites
32 minutes ago, Sarah Terry said:

Hi @Mosh - The total number of resources (including those in sub-groups) should be returned in the group object information - i.e. GET /device/groups/ID. This is actually what the tooltip in the UI is pulling from. Have you tried this yet?

Ah! Thanks @Sarah Terry  I was looking at the documentation which all had examples with another path after the /id and it never occurred to me to try just up to the id!

Cheers.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.