1/1/2024 0 Comments Jamf api scriptsKeep in mind that JSON is only supported for retrieving information from the Classic API, you’ll still need to use XML to perform PUT, POSTS, or DELETES. To do so, simply set the Accept header to “application/json”. Luckily, the Classic API supports receiving output in JSON. If so, then you likely don’t want to have to import libraries and modules for dealing with XML. Many of our customers and partners who are scripting events to run on a Mac will already have toolsets for parsing and serializing objects in JSON. Postman allows you to easily generate, save and parse API requests directly within a simple interface. Postman is an API development tool that is quickly becoming the de facto standard for building and interacting with REST APIs. That’s why we recommend downloading Postman ( ) to take things to the next level. While cURL is a quick and easy way to get started interacting with the Classic API, it can become a little cumbersome to use after a while. You should see an XML response that includes a listing of all computers in your Jamf Pro server. Here is an example of how to use cURL to interact with the “Computers” endpoint of the Classic API: curl -s -u myserviceaccount:mypassword It’s very useful and convenient to use for interacting with APIs. cURL is used to get or send data using a variety of different protocols. MacOS comes with a great little command-line tool called cURL. Simply execute the script with one parameter being the string you’re looking for.In addition to the API Reference, you’ll find some general documentation around how the Classic API functions and also some code samples that show how to perform common tasks in the API. The shell script will not work if you try to launch it using sh /path/to/searchScriptsInJamf.shĮither make it executable or use bash /path/to/searchScriptsInJamf.sh Usage If a variable is filled, the information is used directly and you're not asked for it during execution.ĭon’t forget to make the script executable on macOS on unix:Ĭhmod u+x /path/to/searchScriptsInJamf.sh You can leave any of the variables empty, for example userPasswd, the script will ask you interactively for the missing information at execution. You can also execute the script and if you didn't fill the variables, it will ask for the relevant informations (URL, username and password). userPasswd to give the password of the account.As mentioned previously, it is recommended to have a dedicated account for that as the credentials will be in the script in plain text (even if mostly that script will be executed from an admin computer) userName to give the name of the account used to authenticate and access the scripts.If you have a specific URL and a specific port, make sure to add it here too. serverURL to give the URL of your Jamf Pro server, for example, if you’re hosted in Jamfcloud that would be something like.Settingsīefore using the script, there are 3 variables to modify to suit your needs: It is recommended to have a specific account that can only read your scripts. ), please use double quotes in the argument (see below for examples in the Usage section). If you want to search for a string containing spaces (like a command and options, for example dscl. The scripts only take 1 argument and will ignore anything else. The result will show the number of scripts or extension attributes (or both if you use the combined script) containing the string but also for each script the lines and the URL and ID of the element in Jamf Pro. It will use the Jamf Pro Classic API to get the list of scripts and iterate through all of them to find the string you’re looking for. This script is designed to search for a string in all the scripts and or extension attributes in your Jamf Pro instance. Interactive version to choose if you want to search scripts, extension attributes or both. If no variables are set in the script, you will be asked for the information. Powershell version if you want to test from a windows computer.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |