Examples School - Jamf-Concepts/apiutil GitHub Wiki
Examples for Jamf School
Please see the Jamf School API Documentation for information about available Jamf School API paths.
Fetching an API Auth string
Assuming our Jamf School entry in the API Utility GUI app is named "school"...
jamfapi --target "school"
That returns the encoded form of the configured username/password. You could use that in an API call if you wanted.
# Return a list of configured apps
URL='https://my-school.jamfcloud.com/api/apps/'
AUTH=$(jamfapi --target "school")
curl \
--silent \
--show-error \
--header "Authorization: Basic ${AUTH}" \
--url "${URL}"
Even Easier
The API Utility can handle the auth and API call in one step. This script returns a count of the devices managed by Jamf School.
JSON=$(jamfapi --target "school" --path "/api/devices")
DEVICE_COUNT=$(echo $JSON | tr -d '\n' | jq '.count')
echo "You have ${DEVICE_COUNT} devices in Jamf School"