Posted on 07-11-2019 01:36 PM
Posted on 07-11-2019 10:42 PM
Here is an example on how to update the check-in settings, make sure you have jq
installed for parsing the json
output:
#!/bin/bash
credentials="dXNlcm5hbWU6cGFzc3dvcmQ="
jps="https://jps.example.com"
uapi_token=$(curl -s -H "Content-Type: application/json" -H "Authorization: Basic ${credentials}" -X POST "${jps}/uapi/auth/tokens" | jq -r '.token')
curl -s -H "Authorization: Bearer ${uapi_token}" -H "Content-Type: application/json" -X PUT --data @- "${jps}/uapi/v1/check-in" <<EOF
{
"checkInFrequency": 15,
"isCreateHooks": true,
"isHookLog": true,
"isHookPolicies": true,
"isHookHideRestore": true,
"isHookMCX": false,
"isBackgroundHooks": true,
"isHookDisplayStatus": true,
"isCreateStartupScript": true,
"isStartupLog": true,
"isStartupPolicies": true,
"isStartupSSH": true,
"isStartupMCX": false,
"isEnableLocalConfigurationProfiles": true
}
EOF
The credentials variable is a Base64 encoded username and password string:
printf "username:password" | iconv -t ISO-8859-1 | base64 -i -