How to delete unregistered auth tokens for Data Collector and Provisioning Agents in Control Hub Cloud using the Rest API?

Step-by-step instructions for utilizing the REST API in Control Hub Cloud to remove unregistered auth tokens, enhancing agent management efficiency:
Generate cookie
curl  -X POST -d '{"userName":"<username>", "password":  "<password>"}'  --header "Content-Type:application/json" --header "X-Requested-By:SCH"  -c cookie.txt
Generate session token
sessionToken=$(cat cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)
echo "Generated session token : $sessionToken"
Delete unregistered auth tokens from Data Collectors
curl -X POST{orgID}/components/deleteNonRegistered/dc --header "Content-Type:application/json" --header "X-Requested-By:SCH" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken" -i
Delete unregistered auth tokens from Provisioning Agents
curl -X POST{orgID}/components/deleteNonRegistered/provisioning-agent --header "Content-Type:application/json" --header "X-Requested-By:SCH" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken"
Note 1: Remember to change the {orgID} to yours (the same you use at login with: username@{orgID}) .
Note 2: For Control Hub on prem, this same method should work if you change the  beginning of the URLs  from '' to your Control Hub URL.

0 replies

Be the first to reply!