Skip to main content
Question

Control Hub REST APIs - cat: cookie.txt: No such file or directory

  • October 13, 2022
  • 3 replies
  • 62 views

I have followed the sample script for using Control Hub REST APIs below. However, I receive this error message 

 

cat: cookie.txt: No such file or directory

{"message":"Authentication succeeded"} Generated session token : 

 

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


sessionToken=$(cat cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)

echo "Generated session token : $sessionToken"

 

Can someone help ? What should I do 

3 replies

saleempothiwala
Headliner
Forum|alt.badge.img
  • Headliner
  • 258 replies
  • October 13, 2022

@siang14501 

Where did you run the curl command? did you get a successful execution?


  • Author
  • Fan
  • 1 reply
  • October 13, 2022

@saleempothiwala I run it at the stop events ( shell ). I did get a successful execution for my pipeline


saleempothiwala
Headliner
Forum|alt.badge.img
  • Headliner
  • 258 replies
  • October 14, 2022

Hi @siang14501 ,

Have you tried running the script on your linux prompt and see if it generates cookie.txt.

It could be possible that when you run the script from within StreamSets then the sdc user does not have permission to create the file. Try something like this:

 

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

sessionToken=$(cat /tmp/cookie.txt | grep SSO | rev | grep -o '^\S*' | rev)