Skip to main content
Best answer

How to keep response JSESSIONID


  • Beginner
  • 4 replies

I want to authenticate to a certain SaaS using Zapier → get information.
The JSESSIONID is issued in the authentication phase, and the JSESSIONID is required in the information acquisition phase of the next step.
However, I don't know how to take over the JSESSIONID included in the response of the authentication phase to the next step. Please tell me how to use the JSESSIONID of the response in the next step.

Best answer by GetUWiredBest answer by GetUWired

Ahhh… so the issue is that the JSESSIONID is included in the response header and not in the response body? The zapier webhook feature will only return what is included in the response body.

You will need to make the request in a code block. You can use a javascript code block & fetch to do this.
You will have to use the input fields to pass the username, password, api key, and timestamp values then you can access them using inputData[‘whatever you defined the input variable as’]
 

let response = await fetch(URL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'username': USERNAME VALUE,
    'password': PASSWORD VALUE,
    'apiKey': API KEY VALUE,
    'timestamp': TIMESTAMP VALUE
  })
});

let headers = await response.headers;

return headers

 

View original
Did this topic help you find an answer to your question?
This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

8 replies

GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • July 12, 2022

Hi @s.t

Are you building a custom app in developer.zapier.com? Or are you using webhooks by zapier to send requests?


  • Author
  • Beginner
  • 4 replies
  • July 13, 2022

Hi,

thank you for your reply.
I am sending using a webhook.


GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • July 13, 2022

Please share screenshots of your configuration. You can chain Zapier steps together… or in other words, have 1 webhook that authenticates and returns the JSESSIONID which can be passed into a second webhook by zapier step. 


  • Author
  • Beginner
  • 4 replies
  • July 13, 2022

Thank you for your reply.

I will attach a screenshot so please check it.


GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • Answer
  • July 14, 2022

Ahhh… so the issue is that the JSESSIONID is included in the response header and not in the response body? The zapier webhook feature will only return what is included in the response body.

You will need to make the request in a code block. You can use a javascript code block & fetch to do this.
You will have to use the input fields to pass the username, password, api key, and timestamp values then you can access them using inputData[‘whatever you defined the input variable as’]
 

let response = await fetch(URL, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    'username': USERNAME VALUE,
    'password': PASSWORD VALUE,
    'apiKey': API KEY VALUE,
    'timestamp': TIMESTAMP VALUE
  })
});

let headers = await response.headers;

return headers

 


  • Author
  • Beginner
  • 4 replies
  • July 14, 2022

thank you for your reply.
I was able to get the header information from the content of the advice !

It's a slightly different question, but is there a way to get the content of the request instead of the response?
Currently, POST with Code by Zapier is being answered with Bad Request, and I would like to confirm the contents of the request.


GetUWired
Forum|alt.badge.img+12
  • Zapier Expert
  • 1030 replies
  • July 15, 2022

Can you share screenshots of your configuration? 

 

To get all of the response, you can just return response from the code block. 


  • Author
  • Beginner
  • 4 replies
  • July 19, 2022

Thank you.
It was solved by returning the response from the custom block.