| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #!/bin/bash
- set -e
- #get OAuth Token
- curl --request POST \
- --url https://app.ninjarmm.com/ws/oauth/token \
- --header 'Content-Type: application/x-www-form-urlencoded' \
- --data grant_type=client_credentials \
- --data client_id=Exx51oPGv_hZ8fgQh2IqtpX5VpA \
- --data client_secret=AAv3WeKnUjSOSRuW94plKdrihEw8AEZCJd38VK56aSGjAa4BAtm_zw \
- --data scope=management
- # Generate installer URL
- curl -X 'GET' \
- 'https://app.ninjarmm.com/v2/organization/26/location/45/installer/LINUX_RPM' \
- -H 'accept: application/json' \
- -H 'Authorization: Bearer GYEHTy3-reBtoPz-vvqQkqMePKk8LU0cJoUwMf7T7VA.2c_ZrDl1CxNRA6Y5Cuy2o94ZDMZsbUkAIeKUUeOE64U'
- # Download installer
- curl -o ninja-agent.deb https://app.ninjarmm.com/agent/installer/e99519fc-b76e-4c50-b5ff-ef68db95b032/serverslinuxmainoffice-5.6.7925-installer-x86-64.rpm
- #!/bin/bash
- # Step 1: Get OAuth token
- oauth_response=$(curl --request POST \
- --url https://app.ninjarmm.com/ws/oauth/token \
- --header 'Content-Type: application/x-www-form-urlencoded' \
- --data grant_type=client_credentials \
- --data client_id=Exx51oPGv_hZ8fgQh2IqtpX5VpA \
- --data client_secret=AAv3WeKnUjSOSRuW94plKdrihEw8AEZCJd38VK56aSGjAa4BAtm_zw \
- --data scope=management)
- # Extract access token from response
- access_token=$(echo "$oauth_response" | jq -r '.access_token')
- # Step 2: Generate installer URL
- installer_response=$(curl -X 'GET' \
- 'https://app.ninjarmm.com/v2/organization/26/location/45/installer/LINUX_RPM' \
- -H 'accept: application/json' \
- -H "Authorization: Bearer $access_token")
- # Extract installer URL from response
- installer_url=$(echo "$installer_response" | jq -r '.url')
- # Step 3: Download installer using generated URL
- curl -o ninja-agent.deb "$installer_url"
|