Get Computer Groups for Specific Site?

NerdMusk
New Contributor II

Hey Everybody,

I'm not seeing the option in the classic API, or maybe I'm missing the obvious, but is it possible to either get all the groups for a specific site, or query what site a group belongs to?  The default query grabs everything, but I'm only interested in groups for a specific site.

jamfGroupArray+=($(curl -sX GET -H "accept: application/xml" -H "Authorization: Bearer ${jssAuth}" "${jssURL}/JSSResource/mobiledevicegroups"))

Thanks again!

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Hi there. There's actually another simple way to do what you're after. Just create an API account with Site access, to the specific Site you're interested in. Ensure the account can read the objects you want in the Privilege settings (or just make it a full Site admin) and when you use that account credentials in the API call, it will only display groups within that Site. By default a Site admin cannot pull up groups that aren't assigned to it, or are not global. This is true even when using the API.

View solution in original post

3 REPLIES 3

NerdMusk
New Contributor II

Found a workaround, though it involves the above and then querying each individual site in the result to see what site it belongs to.  Would be nice if there was an option to specify the site in the above CURL request.

mm2270
Legendary Contributor III

Hi there. There's actually another simple way to do what you're after. Just create an API account with Site access, to the specific Site you're interested in. Ensure the account can read the objects you want in the Privilege settings (or just make it a full Site admin) and when you use that account credentials in the API call, it will only display groups within that Site. By default a Site admin cannot pull up groups that aren't assigned to it, or are not global. This is true even when using the API.

NerdMusk
New Contributor II

Thanks m2270.  I'll check with our site admin to see if this can be done for me.