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>"}' https://cloud.streamsets.com/security/public-rest/v1/authentication/login --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 https://cloud.streamsets.com/security/rest/v1/organization/{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 https://cloud.streamsets.com/security/rest/v1/organization/{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 'https://cloud.streamsets.com/' to your Control Hub URL.