How to pass json file as parameter in RESTAPI call

  • 14 July 2023
  • 0 replies


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.

1- Login to SCH security app:

curl -X POST -d '{"userName":"DPMUserID", "password": "DPMUserPassword"}' --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<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<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"

0 replies

Be the first to reply!