Intended for macOS administrators in an Jamf Pro environment.
Fetch non sensitive data about a Computer from Jamf API without autentication.
# serial=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')
curl 127.0.0.1:5000/computer/$serial
{
"asset_tag": "59458",
"serial_number": "C02ZN353MD8F",
"username": "henrik.engstrom@shi******.com",
"ad_user": "henen62",
"shared_computer": "False"
}- Clone repository
git clone https://github.com/cr3ation/client-jamf-api/ - Create python3 venv and run
pip install -r requirements.txtto install required modules. - Edit settings in
./app/config/settings_template.pyand save as./app/config/settings.py. - Run with
python3 ./app/app.py
No guide created. Feel free to make pull request.
# Rename settings_sample.py to settings.py
# Generate jss_credentials with:
# printf "username:password" | iconv -t ISO-8859-1 | base64 -i -
jss_server = "YOUR_JAMF_PRO_URL"
jss_credential = "YOUR_CREDENTIALS"
attributes = {
"extension_attributes": [
{
"id": 32, # Extenssion attribute ID
"name": "shared_computer", # Name in API output
},
{
"id": 11,
"name": "Whetever..."
}
]
}- Set
YOUR_JAMF_PRO_URLtocompany.jamfcloud.com - Set
YOUR_CREDENTIALSto output ofprintf "username:password" | iconv -t ISO-8859-1 | base64 -i - - Modify
extenssion_attributes. Attributes is added out the web response withnameas key
Extenssion Attribute ID is located in Jamf Pro URL.

Test if server is up and running
curl 127.0.0.1:5000/hello
"Hello, World!"Get data from serialnumber
curl 127.0.0.1:5000/computer/C02ZN353MD8F
{
"asset_tag": "59458",
"serial_number": "C02ZN353MD8F",
"username": "henrik.engstrom@company.com",
"ad_user": "henen62",
"shared_computer": "False"
}
Example of use by a client machine
serial=$(system_profiler SPHardwareDataType | awk '/Serial/ {print $4}')
curl 127.0.0.1:5000/computer/C02ZN353MD8F > /Library/foo/bar/computer_info.json
# Set ComputerName
# Set HostName
# Set LocalHostName
# Write ad-user to settings file
...
In order to run within a container you'll need docker installed.
docker build -t client-jamf-api:latest . docker run -d -p 5000:5000 client-jamf-api:latestjss_server- Not yet implementedjss_secret- Not yet implemented
/app/config- All your settings
/app/app.py- Main application/app/config/settings.py- Update to add extenssion attributes
Please read CONTRIBUTING.md for details on code of conduct, and the process for submitting pull requests.
- Henrik Engström - Initial work - cr3ation See also the list of contributors who participated in this project.
This project is licensed under the MIT License - see the LICENSE.md file for details.