Solved

RestFul API

  • 28 March 2023
  • 7 replies
  • 101 views

Above is the Rest API to get the job details for a particular job id which I am able to get it by sending the request through sch or using the URL in any browser, But when I am trying to hit the same URL along with header and params in postman I am not getting any response as shown bellow:

 

icon

Best answer by AkshayJadhav 28 March 2023, 15:28

View original

7 replies

Userlevel 4
Badge

Hello @saikat_chatterjee - Thank you for reaching out to the StreamSets Community Platform. I ran a couple of test and able to get the same response from the contolhub host using Postman API application.

You have add all the headers mentioned in the command and replace the $sessionToken with actual token.

--header "Content-Type:application/json" --header "X-Requested-By:SCH" --header "X-SS-REST-CALL:true" --header "X-SS-User-Auth-Token:$sessionToken" -i

Here is the screenshot from postman application:

 

Let me know how it goes.

Thank you - AkshayJ

@AkshayJadhav From where to get the token, can you help me.

Userlevel 4
Badge

Hi @saikat_chatterjee -You will find the details on Contorlhub UI » Restful API » Job Runner page at the top side.

 

This is how I generated the token.

# login to Control Hub 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:SCH" -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"
Userlevel 4
Badge

Did it work? @saikat_chatterjee ?

Userlevel 4
Badge

Hi @saikat_chatterjee - Could you please confirm if that resolves the issue? If yes, please mark the comment as best answer to close the thread.

Thank you - AkshayJ

Hi @AkshayJadhav, still I was unable to generate the session token, from job runner tab I got the curl command and I was using my api credentials along with that but not sure how to get the session token which you suggested.

Userlevel 4
Badge

@saikat_chatterjee Thank you for closing the thread. You can run the commands that I shared and generate the auth token.

Reply