REST to retrieve all computers associated with a user

RCL1
New Contributor

Folks-

I need to generate a REST query that lists all computers and their attributes that are associated with a given user. I've looked through documentation, and Bryson Tyrrell's postings, but have had no success.

Thanks,

RL

1 REPLY 1

freddie_cox
Contributor III

The following will produce the same results as searching for the user in the GUI. Replace $UserID with their ID/Username.

https://jss.yourorg.com:8443/JSSResource/computers/match/$UserID

Perform a GET on this (You can even type in the address bar of your browser to test)

Edit: Here's an example of how you would do this with cURL. Just fill in the JSSAPI Username and Password. This will dump the XML output to your desktop.

curl -v -u "$JSSAPIUser:$JSSAPIPass" https://jss.yourorg.com:8443/JSSResource/computers/match/$UserID -X GET -o ~/Desktop/UserInfo.xml

Notes:
-This assumes you have the user assigned on the user and location tab. -This will only return a sub-set of computer information, if you need additional information you will have to perform a query on each computer object and parse the desired data.