Hello !
First of all, please excuse me if the questions are found somewhere else, but I can't find clearly the informations needed. Please note that I'm not familiar with API.
As the basic authentication will be soon removed, I already disabled it in Jamf Pro. I checked all my scripts and it seems that it's working fine. However, I have some questions:
1) I read that classic API uses JSSResource as part of the URI. And I have this example to get the department of a computer. I would like to change that so I can use the api/v1 URI but I can't find the exact path. Actually, I get the department this way:
department=$(curl -H "Accept: application/xml" --header "Authorization: Bearer ${token}" "${jssURL}JSSResource/computers/serialnumber/${macSerial}" | xmllint --xpath "string (//computer/location/department)" -)
How should I change this ? And first of all, is it still possible to do this way ?
2) I use keywords in the position and room fields of a computer's inventory. It allows me to put those computers in smartgroups, and it also allows me to set specific configurations depending on their location and/or department using scripts. As an example, I use keywords of some computers in the room part of their inventory to configure the default printer, but I may have to use their department or location for that. One script is better than 22 policies for our 22 copiers... (And it works fine until now). Well, how can I get this still working ? Here is an example of the command used:
meetingRoom1=$(curl -H "Accept: application/xml" --header "Authorization: Bearer ${token}" "${jssURL}JSSResource/computers/serialnumber/${macSerial}" | xmllint --xpath "string (//computer/location/room)" - | grep "meeting1")
3) I could get the computer's informations using https://mycompany.jamfcloud.com/JSSResource/computers/serialnumber/myserialnumber. But it doesn't work anymore as I disable the classic authentication. It ends with an "Unauthorized" error message of course. It helped me a lot when I had to get the path of an information that I wanted to use in a variable (In the examples above, the "//computer/location/department" or the //computer/location/room part). I found in the company's URI /api/doc what it seems that I need, but I have an error 401 when I try to go to (for example) https://mycompany.jamfcloud.com/api/v1/departments and I don't know how to have the authorization like in the /api/doc section for the Jamf API. Is there a way to get the schema of a computer's informations so that I can find what I need to get the information ?
Any information that helps me better understand how it works is welcome.
Olivier