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

derek_ritchison
Contributor

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?

1 ACCEPTED SOLUTION

AntMac
Contributor

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 solution in original post

2 REPLIES 2

AntMac
Contributor

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' - 

 

derek_ritchison
Contributor

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.