Skip to main content

ISSUE:

We would like to pass json file as a parameter in the REST API Call to update an ACL.
API I want to use is - /jobrunner/rest/v1/sdc/{sdcId}/acl.

Solution: 
1- Login to SCH security app:

curl -X POST -d '{"userName":"DPMUserID", "password": "DPMUserPassword"}'  https://cloud.streamsets.com/security/public-rest/v1/authentication/login --header "Content-Type:application/json" --header "X-Requested-By:SDC" -c cookie.txt

2. Generate auth token from the security app:

sessionToken=$(cat cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)
echo "Generated session token : $sessionToken"

After that you can call the SCH REST API using the auth token:
 
Command to fetch the Details of acl before updating:(Please change the sdc ID as per your sdc ID)

curl -X GET https://cloud.streamsets.com/jobrunner/rest/v1/sdc/<sdc_id>/acl --header "Content-Type:application/json" --header "X-Requested-By:SCH" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken" -i

 
Update command:

curl -X POST https://cloud.streamsets.com/jobrunner/rest/v1/sdc/<sdc_id>/acl --header "Content-Type:application/json" --data @/Users/Documents/sdc.json --header "X-Requested-By:SCH" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken"
Be the first to reply!

Reply