-
Notifications
You must be signed in to change notification settings - Fork 1
Command
apiutil(1)
apiutil – A command-line tool for interacting with Jamf APIs.
apiutil [OPTIONS]apiutil simplifies the process of making API calls to Jamf product APIs. A companion GUI app is run prior to calling the command line binary to setup target server URLs and authentication credentials.
| Argument | Description |
|---|---|
--help, -h |
Displays help on available command line parameters, basic usage examples. |
--show-targets, -s |
Displays a list of targets, both name and URL. |
--version, -v |
Displays version information; running version, latest available version, and if an update is available. |
--target <NAME> |
Specifies the target API server and authentication for the request by its display name. (Optional if only one target has been configured for the app, required otherwise) |
--method <METHOD> |
The HTTP method for the API request, e.g. GET, POST, PUT, PATCH, DELETE. (Optional. A get will be performed if not specified) |
--path <PATH> |
Specifies the API path, relative to the base server URL. For example, /JSSResource/buildings or /api/v1/buildings/id/9. (Required if making an API call. Calling a target with no path will return a bearer token.) |
--data <PAYLOAD> |
Specifies the payload body for paths and methods (POST/PUT/PATCH) that accept data. (Omit unless data is required by the HTTP method) |
--accept <MIME_TYPE> |
Overrides the default Accept header. Used for paths that can return data in multiple formats (Jamf Pro's Classic API can return data as either JSON or XML). (Optional, "application/JSON") will be requested if not specified
|
--content, --content-type <MIME_TYPE>
|
Overrides the Content-Type header for the request. (Optional, defaults to "text/XML" for Classic API, "application/JSON" for Jamf Pro API) |
--cacheLocalAuth "true" or "false" |
For targets that require authentication, use "true" to cache the auth. If you include the same option when making subsequent calls, the cached authentication will be re-used. Use "false" to reset the authentication. |
Determine if an update to the app is available:
apiutil -v | jq -r '."update-available"'
Get a list of buildings:
apiutil --target "pro-prod" --path "/JSSResource/buildings"
Create a new building:
apiutil --method "POST" --path "/JSSResource/buildings" --data "<building><name>Building Name</name></building>"
XML/JSON files can also be used rather than entering the configuration in-line:
apiutil --method "POST" --path "/JSSResource/buildings" --data "/Users/support/Downloads/new_building.xml"
If using a file to create/modify an object access to the folder containing the file must first be enabled. Open the UI for API Utility and go to Settings:
- click apiutil in the menu bar
- click Settings....
- click +
- browse to and select the folder containing the file
For example, to access files contained in /Users/Shared/Replicator (and sub-folders):

Important: Files located with-in the user's Downloads folder (or sub-folder) do not need to be added to the permitted file access paths.
0 : success
1 : error
- Extended examples are available in the following sections of this document.
- Jamf's API Developer Documentation homepage is available at https://developer.jamf.com/