Command - Jamf-Concepts/apiutil GitHub Wiki
jamfapi(1)
jamfapi – A command-line tool for interacting with Jamf APIs.
jamfapi [OPTIONS]
jamfapi 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 |
---|---|
--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. |
Get a list of buildings:
jamfapi --target "pro-prod" --path "/JSSResource/buildings"
Create a new building:
jamfapi --method "POST" --path "/JSSResource/buildings" --data "<building><name>Building Name</name></building>"
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/