# Getting data from web api - cookies issue?

**URL:** <https://discourse.nodered.org/t/getting-data-from-web-api-cookies-issue/32045>\
**Category:** General\
**Created:** [26 August 2020 14:31 UTC](https://discourse.nodered.org/t/getting-data-from-web-api-cookies-issue/32045 "2020-08-26T14:31:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![unclebob](https://avatars.discourse-cdn.com/v4/letter/u/cc9497/32.png) [@unclebob](https://discourse.nodered.org/u/unclebob)\
**Post date:** [26 August 2020 14:31 UTC](https://discourse.nodered.org/t/getting-data-from-web-api-cookies-issue/32045/1 "2020-08-26T14:31:26Z")

</div>

Hi all,

First time user of Node-Red and maybe biting off more then I can chew!

I want to connect to the following website, and pull down my data, it is a two step process on the website.  
first go to  
[https://homebrew.n3rgy.com/consumer-data/](https://homebrew.n3rgy.com/consumer-data/)

enter the password and press set. That creates a cookie which is stored in the browser.

Then i want to go to  
[https://homebrew.n3rgy.com/cgi-bin/n3rgy-consumer-data.py](https://homebrew.n3rgy.com/cgi-bin/n3rgy-consumer-data.py)?  
and get the data. (eventually i want to write it off into mysql but small steps...)

I can make the call to the second page, but get not authorised, i assume because the cookie can not be found?

I initially tried on python, but don't understand web site calls enough to get that working either!

Any hints/tips or outright information on steps? I don't need anything fancy to input the password - happy to hard code that into the process, but essentially i'm stuck at the process of putting the password in the box, pressing the set (or the coding equivalent) and storing the cookie for the second call...

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [29 August 2020 20:21 UTC](https://discourse.nodered.org/t/getting-data-from-web-api-cookies-issue/32045/2 "2020-08-29T20:21:06Z")

</div>

You need to look at what the site is expecting to receive in the way of headers and cookies.

Try using your browser to do a normal login and look at the developer tools network tab. Clicking on the entries there will show you the sent headers.

Knowing that, you then need to set up a flow that captures the data from the first page (may just be a cookie or may need other headers such as an `authorization` header). When you have that, you can add the headers to the 2nd request.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 October 2020 20:21 UTC](https://discourse.nodered.org/t/getting-data-from-web-api-cookies-issue/32045/3 "2020-10-28T20:21:11Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
