Posted on 01-02-2018 07:19 AM
How can i retrieve a list of mobiledevicesmartgroups? The api documentation (https://overview.jamfcloud.com/uapi/doc/) only refers to search members of that groups (POST /mobileDevice/obj/smartgroup/{id}/recalculate), but not how to get a list of groups.
Or is there any other way to read lists of devices from jamf using the api?
Posted on 01-02-2018 08:48 AM
I'm not sure what's up with the documentation you linked to. It looks very incomplete to me. I think it might be a work in progress. I would try hitting the built in documentation on your JSS directly for more information, as in https://your.jss.url.com:8443/api
You can try the following in the shell, which works for me to pull the 3 default groups, even though we don't use our Jamf Pro setup to manage mobile devices.
curl -H "Accept: application/xml" -sfku apiusername:apipassword https://your.jss.url.com:8443/JSSResource/mobiledevicegroups | xmllint --format - | awk -F'>|<' '/<name>/{print $3}'
Keep in mind this will likely pull ALL groups, Smart and Static. If you want to extract only the Smart Groups then throw in the following grep before the awk section.
grep -B1 "<is_smart>true"
Also, the JSS Resource URL may be slightly different in version 10.x. This is from a late version 9.x JSS. Meaning it might be mobiledevicesmartgroups
instead of mobiledevicegroups
. I'm not completely certain.
Posted on 01-02-2018 11:06 AM
You can get a list of all Mobile Smart Groups by using the API
…/JSSResource/mobiledevicegroups
You can further get detail information about each Mobile Device Group by using the ID of each group
…/JSSResource/mobiledevicegroups/id/<##>
This will give you the
Criteria of each Group
The Site of the Group
The mobile devices that are part of the Group (ID, Name, Mac Address, UDID, Wifi Mac Address, Serial Number)
If you use a Database to do this (like FileMaker Pro), you can link the Serial Number in the Mobile Device Group to the Serial Number of the Mobile Devices to get more detail on each mobile device when looking at the Smart Group.