Get Smart Computer Group membership via the REST API

NullPointer
New Contributor III

I'm looking for the correct API method to get a list of computers in a smart group.

The documentation for smart-computer-groups-preview says it does exactly what I want, but I believe that description is incorrect.

It says: Recalculates the smart group for the given id and then returns the ids for the computers in the smart group

That's exactly what I need... unfortunately, it doesn't work. It just returns the count of computers in the Smart Group, it doesn't return the list of computer IDs. Even the example responses in the documentation just show it returning a Count.

What's the right way to get the list of computers in a Smart Group from the API? 

Thank you!

4 REPLIES 4

sdagley
Esteemed Contributor II

@NullPointer I'd agree that API endpoint description should do what you're asking but actually doesn't (at least as of JSS 10.49.0) so you should report that to Jamf Support

You can however get the information using the https://yourServer.jamfcloud.com/JSSResource/computergroups/id/{id} endpoint of the Classic API.

NullPointer
New Contributor III

Thanks @sday, I'll do that!

NullPointer
New Contributor III

Jamf support said they were unsure if or when it would be resolved and that the V1 of the API should work for now and that the functionality may change over time... so I'll investigate the Classic API as you suggested, @sdagley . Thanks again! 

noahdowd
Contributor

Well that's damned annoying. I'm trying to get FortiClient to pull a list of computers from a smart group (preferably names, but I guess IDs would do) to check compliance. I created the API role and everything. Now I have to make it a user? Lame.