Posted on 08-30-2017 12:05 PM
So, I've got a request from our software integrators to get a listing of every app and what groups its scoped to live and at a glance. First knee jerk reaction was to say "look at the mobile device app catalog". If you have an app scoped to multiple groups, the GUI says "2 mobile device groups" instead of listing what groups they are. I currently have told the integrators to drill down on the scope to see that info. They don't want to do that for every app.
Anyway, so I got to thinking about what I learned about the API and remembered I could do something to the effect of
sudo curl -ksS -X GET -H "Accept: application/xml" -u "myusername":"my password" https://jss.myorg.org:8443/JSSResource/mobiledeviceapplications/id/5 | xmllint -format - > ~/Desktop/prettyformat.xml
and get a sample app's name and the group names it is scoped to in XML. Problem is, that particular command also includes a lot of extraneous information for that app including some binary code.
Would anyone know the syntax to take the output of the command above and finesse it to only display the mobile device app's name and what mobile device groups a given app is scoped to? for extra credit if that gets answered, would anyone know how the syntax to write a loop that scopes through each app id (1-whatever number) and records this info to a text file or CSV file?
I know I'm asking a lot so I am very grateful for any help in advance. Even helping with part of this would be cool.