How to authentication to Control Hub using curl command?

  • 21 December 2021
  • 0 replies
  • 370 views

Userlevel 4
Badge
# login to Control Hub security app
curl -X POST -d '{"userName":"DPMUserID", "password": "DPMUserPassword"}' https://ip-to-control-hub:port/security/public-rest/v1/authentication/login --header "Content-Type:application/json" --header "X-Requested-By:SDC" -c cookie.txt
# generate auth token from security app
sessionToken=$(cat cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)
echo "Generated session token : $sessionToken"
# Call SDC REST APIs using auth token                                           
curl -X GET http://ip-to-sdc:port/rest/v1/pipelines/status --header "Content-Type:application/json" --header "X-Requested-By:SDC" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken" -i

Note: change the GET method and REST API URL accordingly 

Here is the list of available rest API entries:

Application Url
Topology https://cloud.streamsets.com/sch/restAPI/app/topology
Provisioning  https://cloud.streamsets.com/sch/restAPI/app/provisioning
Scheduler https://cloud.streamsets.com/sch/restAPI/app/scheduler 
Security https://cloud.streamsets.com/sch/restAPI/app/security
Pipeline store  https://cloud.streamsets.com/sch/restAPI/app/jobrunner
Job runner  https://cloud.streamsets.com/sch/restAPI/app/pipelinestore
Reports https://cloud.streamsets.com/sch/restAPI/app/provisioning
Protection Policies https://cloud.streamsets.com/sch/restAPI/app/policy
Custom Classifications https://cloud.streamsets.com/sch/restAPI/app/sdp_classification
Alerts https://cloud.streamsets.com/sch/restAPI/app/notification

This topic has been closed for comments