JSS API for dummies??

bentoms
Release Candidate Programs Tester

Anyone got a good dummies guide for the JSS API (or REST).

I want to query a devices assigned peripheral. (We have some software that is licensed to the macs induvidually.. So I'd like to add the license as a peripheral & then query the JSS for it).

1 ACCEPTED SOLUTION

mm2270
Legendary Contributor III

Are you talking about doing it in the shell, or within an app using something like Ruby on Rails / Java, etc?
I can't offer anything on the latter, but I've been doing a fair amount of shell based queries against our API. Up until the information posted by JAMF SE John Miller in this thread, I was struggling with it a bit since parsing data from the xml result is painful. The information on using xpath has helped tremendously.

https://jamfnation.jamfsoftware.com/discussion.html?id=5968

Note that certain pieces of data, such as Peripherals and Extension Attributes are a bit trickier to extract because you can't call them specifically by a name in the xml. They drop into a sort of array with numbers for each, rather than a readable label, almost like you see with items in a plist when calling them through PlistBuddy, so you might need to first find out how many items are in the list, then loop through each until you hit the one you're looking for.

All the above said, I'd love to see some kind of solid documentation on using the API. There is the built in stuff on your JSS, which at least gets you started, but it leaves a lot to be desired as far as examples go.

View solution in original post

2 REPLIES 2

mm2270
Legendary Contributor III

Are you talking about doing it in the shell, or within an app using something like Ruby on Rails / Java, etc?
I can't offer anything on the latter, but I've been doing a fair amount of shell based queries against our API. Up until the information posted by JAMF SE John Miller in this thread, I was struggling with it a bit since parsing data from the xml result is painful. The information on using xpath has helped tremendously.

https://jamfnation.jamfsoftware.com/discussion.html?id=5968

Note that certain pieces of data, such as Peripherals and Extension Attributes are a bit trickier to extract because you can't call them specifically by a name in the xml. They drop into a sort of array with numbers for each, rather than a readable label, almost like you see with items in a plist when calling them through PlistBuddy, so you might need to first find out how many items are in the list, then loop through each until you hit the one you're looking for.

All the above said, I'd love to see some kind of solid documentation on using the API. There is the built in stuff on your JSS, which at least gets you started, but it leaves a lot to be desired as far as examples go.

bentoms
Release Candidate Programs Tester

Thanks Mike, shell is what I'll be using.

It's just a little daunting on 1st glance.

I'll have a nose though that thread.

Thanks again!