Skip to main content
Solved

Classic API --- "users/user/links/computers/" Returns Blank


Forum|alt.badge.img+5

In the UI my users are _absolutely_ assigned computers, yet they do not appear in my API response. This shouldn't be a permissions thing. I'm very confused. Anyone seen this before?

Best answer by AntMac

Making an assumption that you are developing a script to call the assigned computer per user? 

I'd suggest reviewing your path syntax to get a name or ID you'd need to go down to the next tag level. Example below shows xpath usage which will 100% return the name of the computer assigned to the username being filtered on. You can also use text() to strip out the meta tags and just have the data. Hope this helps.    

 

curl -s -k -H "Authorization: Bearer $bearerToken" -H "content-type: text/xml" -X GET "$url/JSSResource/users/name/username" | xmllint --xpath '/user/links/computers/computer/name' -

 

View original
Did this topic help you find an answer to your question?

AntMac
Forum|alt.badge.img+10
  • Valued Contributor
  • March 28, 2024

Making an assumption that you are developing a script to call the assigned computer per user? 

I'd suggest reviewing your path syntax to get a name or ID you'd need to go down to the next tag level. Example below shows xpath usage which will 100% return the name of the computer assigned to the username being filtered on. You can also use text() to strip out the meta tags and just have the data. Hope this helps.    

 

curl -s -k -H "Authorization: Bearer $bearerToken" -H "content-type: text/xml" -X GET "$url/JSSResource/users/name/username" | xmllint --xpath '/user/links/computers/computer/name' -

 


Forum|alt.badge.img+5

This did the trick! Thank you so much!

 

I'm still very confused at how/why the response from Jamf is so weird. I'm used to just clean, straight JSON.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings