

Command being sent – This will be DELETE, GET, PUT or POST.įor all commands except DELETE, we also need to specify a header as this will specify for Jamf Pro if we’re using XML or JSON.-X or –request – We’re using the curl option for sending a request because we’re sending in a request for Jamf Pro to do something.URL – We’re using the API base URL followed by the specific API endpoint and data identifier.
#Jamf api scripts password
Authentication – In this case, we’re using the username and password of a Jamf Pro user with the correct privileges to run the API command.Tool being used – In this case, we’re using curl.When sending one of these commands to Jamf Pro, you must include the following: When using the Classic API, there are four commands available: In contrast, a number of XML parsing tools (like xmllint and xpath) are installed as part of macOS Catalina and earlier, which means that the Mac admin can currently rely on them being available if the Mac admin needs to run API-using scripts on managed Macs. However, they are not installed as part of macOS Catalina or earlier which means that its up to the Mac admin to make sure the relevant JSON parsing tools are installed and up to date on the Mac admin’s managed Macs. There are tools available for macOS which allow easy JSON parsing and manipulation, with jq being an excellent example. While you can both input and output XML, JSON can only be output.
#Jamf api scripts update
Update – January 3, 2020: As Graham Pugh pointed out in the comments, I made a mistake originally on what can be done with JSON, where I stated that both JSON input and output were supported.
#Jamf api scripts how to
Of the two, the Classic API is the one currently most used by Jamf Pro admins and the one I’ll be focusing on how to use it, using XML for input and output. Creates a new token with the same access rights as the existing token.įor more details, please see below the jump.The new token generation process does the following:

However, you can generate a new token for API authentication using the existing token’s credentials. These tokens are time-limited and expire after 30 minutes. The Jamf Pro API is designed to work with token-based authentication, with a Jamf Pro username and password used to initially generate the necessary token. If your Jamf Pro server is, that means that the API base URL is as follows: The base URL for the Jamf Pro API is located at /uapi on your Jamf Pro server. This API is in beta and is designed to be an eventual replacement for the Classic API.

The Classic API is designed to work with usernames and passwords for authentication, with the username and password being passed as part of the curl command. To help you become familiar with the API, Jamf includes documentation and “Try it out” functionality at the following URL on your Jamf Pro server: The base URL for the Classic API is located at /JSSResource on your Jamf Pro server. This API is designed to work with XML and JSON. This API is the original one which Jamf Pro started with and it is slated for eventual retirement.
