I think you're looking for https://your.jamf.server.com/api
From there you can access the Classic or new Jamf Pro API documentation. Hopefully that's helpful.
So are you trying to use the API to pull that list of information from a computer record? I do not believe there is any variable list for the API. The only variables I am aware of are those used for Configuration Profiles, and other areas:
https://docs.jamf.com/10.28.0/jamf-pro/administrator-guide/Computer_Configuration_Profiles.html
For the API, if you're sending a call to gather those items, you would use xpath or maybe xmllint to pull just the data you want out of the XML returned from an API call. For example, this snippet would be used in Bash/Zsh to pull the serial number of a device from the returned XML:
JSS_ID=$(curl -H "Accept: text/xml" -sfku "${apiUser}:${apiPass}" "${jpsURL}/JSSResource/computers/serialnumber/${serial}/subset/general" | xpath /computer/general/id | awk -F'>|<' '{print $3}')
So if you wanted to pull the values you have listed, you'd need to do something similar for each one.
I'm sure there's someone out there that has a more elegant way to pull the info out of the XML.
So are you trying to use the API to pull that list of information from a computer record? I do not believe there is any variable list for the API. The only variables I am aware of are those used for Configuration Profiles, and other areas:
https://docs.jamf.com/10.28.0/jamf-pro/administrator-guide/Computer_Configuration_Profiles.html
For the API, if you're sending a call to gather those items, you would use xpath or maybe xmllint to pull just the data you want out of the XML returned from an API call. For example, this snippet would be used in Bash/Zsh to pull the serial number of a device from the returned XML:
JSS_ID=$(curl -H "Accept: text/xml" -sfku "${apiUser}:${apiPass}" "${jpsURL}/JSSResource/computers/serialnumber/${serial}/subset/general" | xpath /computer/general/id | awk -F'>|<' '{print $3}')
So if you wanted to pull the values you have listed, you'd need to do something similar for each one.
I'm sure there's someone out there that has a more elegant way to pull the info out of the XML.
I guess it's not API but what I am trying to do is pull the required fields from Jamf and store the info in a PList file on the workstation (that it is related to).
then when need by script, I use this command to get the information
userDept=$( /usr/bin/defaults read "Library/Managed Preferences/com.company.userinfo.plist" department)
I guess it's not API but what I am trying to do is pull the required fields from Jamf and store the info in a PList file on the workstation (that it is related to).
then when need by script, I use this command to get the information
userDept=$( /usr/bin/defaults read "Library/Managed Preferences/com.company.userinfo.plist" department)
Yep, pretty sure Steve is right that you're looking for configuration profile payload variables. Lists would be here:
macOS: https://jamf.it/macprofile
iOS: https://jamf.it/iosprofile
I guess it's not API but what I am trying to do is pull the required fields from Jamf and store the info in a PList file on the workstation (that it is related to).
then when need by script, I use this command to get the information
userDept=$( /usr/bin/defaults read "Library/Managed Preferences/com.company.userinfo.plist" department)
Here's an example script that would do what you are looking for. You can duplicate the example of pulling the department and storing it to get the other items you want to store.
****!!!!!!***** HOWEVER, I would strongly suggest you to reconsider doing this. The use of credentials in scripts is not recommended as it is a security risk. The credentials for the API account are available in clear text on the device. It's better to find a different way to do what you are attempting to do.
#!/bin/zsh
#set -x
xpath() {
# the xpath tool changes in Big Sur
if [[ $(sw_vers -buildVersion) > "20A" ]]; then
/usr/bin/xpath -e "$@"
else
/usr/bin/xpath "$@"
fi
}
apiUser='' #### put in your API user
apiPass='' #### put in your API user password
jpsURL="" #### put in your JPS URL
local_plist="/tmp/com.test.plist" ### change to where you want the plist stored and named
serial=$(system_profiler SPHardwareDataType | awk '/Serial\\ Number\\ \\(system\\)/ {print $NF}');
## get xml of computer
comp_xml=$(curl -H "Accept: text/xml" -sfku "${apiUser}:${apiPass}" "${jpsURL}/JSSResource/computers/serialnumber/${serial}")
# grab the department and store in our local plist
dept=$( echo $comp_xml | xpath /computer/location/department | awk -F'>|<' '{print $3}')
defaults write "$local_plist" Department "$dept"