Update Job using REST API

  • 6 March 2024
  • 1 reply

I have a requirement to update job parameter via restAPI. I get the job details via GET function. I modify the content via code. But I am not sure how to pass the modified json content in a variable/file in the restapi post call? I have the need to run the api as automated batch with no manual intervention. I tried below two ways but none worked. I dont see any other viable option to pass modified content in the curl command.

var1=`cat /home/script/modified.json`

curl -X POST -d '{ @var1}’ -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: $CRED_ID" -H "X-SS-App-Auth-Token: $CRED_TOKEN" -i


curl -X POST -d '{ /home/script/modified.json}’ -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: $CRED_ID" -H "X-SS-App-Auth-Token: $CRED_TOKEN" -i

1 reply

This one worked for me. The curl post command has to have -d followed by @ to define the file that is to be posted

 -d @/path/to/modifiedData.txt


curl -X POST  -d @/path/to/modifiedData.txt -H "Content-Type:application/json" -H "X-Requested-By:curl" -H "X-SS-REST-CALL:true" -H "X-SS-App-Component-Id: $CRED_ID" -H "X-SS-App-Auth-Token: $CRED_TOKEN" -i