Best answer

How to keep response JSESSIONID


Userlevel 1

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.

icon

Best answer by GetUWired 14 July 2022, 15:36

View original

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

Userlevel 7
Badge +12

Hi @s.t

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

Userlevel 1

Hi,

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

Userlevel 7
Badge +12

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. 

Userlevel 1

Thank you for your reply.

I will attach a screenshot so please check it.

Userlevel 7
Badge +12

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

 

Userlevel 1

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.

Userlevel 7
Badge +12

Can you share screenshots of your configuration? 

 

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

Userlevel 1

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