# Need help in http request node

**URL:** <https://discourse.nodered.org/t/need-help-in-http-request-node/68612>\
**Category:** General\
**Created:** [5 October 2022 22:49 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612 "2022-10-05T22:49:20Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [5 October 2022 22:49 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/1 "2022-10-05T22:49:20Z")

</div>

Hi im trying to figure how to use curl in nodered ..I want to get information of my torrent files (which has api support)  
i want to convert this part of code to nodered style.

```auto
$ curl -i --header 'Referer: http://localhost:8080' --data 'username=admin&password=adminadmin' http://localhost:8080/api/v2/auth/login
HTTP/1.1 200 OK
Content-Encoding:
Content-Length: 3
Content-Type: text/plain; charset=UTF-8
Set-Cookie: SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ; path=/
$ curl http://localhost:8080/api/v2/torrents/info --cookie "SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ"

```

and get the information in debug window.  
the api documentation is as follows:

> **[WebUI API (qBittorrent 4.1) · qbittorrent/qBittorrent Wiki](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#:~:text=Example%20showing%20how%20to%20login%20and%20execute%20a%20command%20that%20requires%20authentication%20using%20curl%3A)**
>
> qBittorrent BitTorrent client. Contribute to qbittorrent/qBittorrent development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 08:40 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/2 "2022-10-06T08:40:50Z")

</div>

Try this...

```auto
[{"id":"606e0c6c93bc3b1a","type":"inject","z":"c876e57260edd2ab","name":"Click me","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":640,"y":780,"wires":[["4a881416445ff3e7"]]},{"id":"4a881416445ff3e7","type":"function","z":"c876e57260edd2ab","name":"","func":"//original curl: \n//\n//curl -i --header 'Referer: http://localhost:8080' --data 'username=admin&password=adminadmin' http://localhost:8080/api/v2/auth/login\n\nmsg.method = \"post\";\nmsg.url = \"http://localhost:8080/api/v2/auth/login\";\nmsg.payload = `username=admin&password=adminadmin`;\nmsg.headers = {\n \"Referer\": \"http://localhost:8080\",\n \"Content-Type\": \"application/x-www-form-urlencoded\"\n};\nmsg.cookies = null;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":820,"y":780,"wires":[["3695a2656792ac3a"]]},{"id":"3695a2656792ac3a","type":"http request","z":"c876e57260edd2ab","name":"","method":"use","ret":"txt","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1000,"y":780,"wires":[["2e35023de976776e"]]},{"id":"2e35023de976776e","type":"debug","z":"c876e57260edd2ab","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1180,"y":780,"wires":[]},{"id":"63543d5f2f46c634","type":"comment","z":"c876e57260edd2ab","name":"Edit this function ↓ and set username/password","info":"","x":860,"y":740,"wires":[]}]

```

Copy the above flow JSON and import it into node-red using `CTRL-I`

Set the url/username/password up in the function node before operating.

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 09:40 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/3 "2022-10-06T09:40:41Z")

</div>

> [@boo](#):
>
> `$ curl http://localhost:8080/api/v2/torrents/info --cookie "SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ"`

yeah this said ok in debug but how to send this to get info

```auto
$ curl http://localhost:8080/api/v2/torrents/info --cookie "SID=hBc7TxF76ERhvIw0jQQ4LZ7Z1jQUV0tQ"

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 09:53 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/4 "2022-10-06T09:53:20Z")

</div>

> [@boo](#):
>
> but how to send this to get info

Set the debug to "show complete message" - you will find the cookie.

Use the "copy path" button on the debug output field value (to grab its path)

Use this path to populate the `msg.cookies` and run the 2nd HTTP-request

`inject --> 1st http-request --> grab cookie, set msg.cookies --> 2nd http-request`

Something like this in a function node before the 2nd http-request...

```auto
msg.cookies = {
    "SID": msg.cookies.SID 
};
return msg;

```

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 10:33 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/5 "2022-10-06T10:33:29Z")

</div>

> [@boo](#):
>
> `http://localhost:8080/api/v2/torrents/info`

thanks tried something and it works but not sure its the right way

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/5/75e56f2ead4da2662751175d7e68d9770440a016.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 10:39 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/6 "2022-10-06T10:39:31Z")

</div>

> [@boo](#):
>
> thanks tried something and it works

Problem solved.

If you want to fully understand what is going on then read up on the HTTP spec in particular headers and cookies 🙂

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 10:49 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/7 "2022-10-06T10:49:33Z")

</div>

thanks but one last help  
can you help how to do this ?  
reference help( i want to add torrent with magnet)

> **[WebUI API (qBittorrent 4.1) · qbittorrent/qBittorrent Wiki](https://github.com/qbittorrent/qBittorrent/wiki/WebUI-API-(qBittorrent-4.1)#:~:text=All%20scenarios-,Add%20new%20torrent,Add%20torrent%20from%20URLs%20example%3A,-POST%20/api/v2)**
>
> qBittorrent BitTorrent client. Contribute to qbittorrent/qBittorrent development by creating an account on GitHub.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 10:52 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/8 "2022-10-06T10:52:26Z")

</div>

Search the forum for POST and multipart.

Also, you might want to consider using a dedicated API helper by importing it in a function node ([qBittorrent - npm search](https://www.npmjs.com/search?q=qBittorrent))

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 10:55 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/9 "2022-10-06T10:55:40Z")

</div>

cant we do this the same way we did with http request post method?

```auto
POST /api/v2/torrents/add HTTP/1.1
User-Agent: Fiddler
Host: 127.0.0.1
Cookie: SID=your_sid
Content-Type: multipart/form-data; boundary=---------------------------6688794727912
Content-Length: length

-----------------------------6688794727912
Content-Disposition: form-data; name="urls"

https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E7.torrent
https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E8.torrent
-----------------------------6688794727912
Content-Disposition: form-data; name="savepath"

C:/Users/qBit/Downloads
-----------------------------6688794727912
Content-Disposition: form-data; name="cookie"

ui=28979218048197
-----------------------------6688794727912
Content-Disposition: form-data; name="category"

movies
-----------------------------6688794727912
Content-Disposition: form-data; name="skip_checking"

true
-----------------------------6688794727912
Content-Disposition: form-data; name="paused"

true
-----------------------------6688794727912
Content-Disposition: form-data; name="root_folder"

true
-----------------------------6688794727912--

```

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 11:02 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/10 "2022-10-06T11:02:10Z")

</div>

> [@boo](#):
>
> ```auto
> POST /api/v2/torrents/add HTTP/1.1
> User-Agent: Fiddler
> Host: 127.0.0.1
> Cookie: SID=your_sid
> Content-Type: multipart/form-data; boundary=---------------------------6688794727912
> Content-Length: length
> 
> -----------------------------6688794727912
> Content-Disposition: form-data; name="urls"
> 
> https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E7.torrent
> https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E8.torrent
> 
> ```

i just want this part to work  
and say i want to add a torrent magnet url `magnet:?xt=urn:btih:a751ad1260d3f1a353cddc20783c8e250579aa10&dn=Thor+and+Torchlight.wmv&tr=http%3A%2F%2Ftracker.anirena.com%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.publicbt.com%3A80%2Fannounce&tr=http%3A%2F%2Fopen.nyaatorrents.info%3A6544%2Fannounce&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80%2Fannounce `  
i understand how post works but this part im really confused, hoping for your help. sorry to bother @Steve-Mcl

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 11:07 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/11 "2022-10-06T11:07:11Z")

</div>

> [@boo](#):
>
> cant we do this the same way we did with http request post method?

Yes.

> [@Steve-Mcl](#):
>
> Search the forum for POST and multipart

- [Upload file to Synology Filestation over API (one more try) - #2 by Steve-Mcl](https://discourse.nodered.org/t/upload-file-to-synology-filestation-over-api-one-more-try/61945/2)
- [Send a file with multipart/form-data to OctoPrint REST API - #15 by knolleary](https://discourse.nodered.org/t/send-a-file-with-multipart-form-data-to-octoprint-rest-api/7534/15)

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 12:13 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/12 "2022-10-06T12:13:26Z")

</div>

@Steve-Mcl thanks but cant get it to work.. my code in function node.. what am i doing wrong?

```nohighlight
var x = "SID="
var cookie = x + y

msg.url = "http://192.168.0.104:8080/api/v2/torrents/add HTTP/1.1";

msg.headers = {};
msg.method = "POST";
msg.headers["Cookie"] = cookie;
msg.headers = {
    "Content-Type": "multipart/form-data; boundary=---------------------------6688794727912"
}
msg.headers = {
    "Content-Length": "length"
}
msg.headers = {
    "Host": "127.0.0.1"
}
msg.headers = {
    "User-Agent": "Fiddler"
}
msg.cookie = cookie;
msg.payload = '-----------------------------6688794727912\r\n'+
    'Content-Disposition: form-data; name="urls"\r\n' +
    '\r\n' +
    'magnet:?xt=urn:btih:0f45480a69ff7b2e948ccfed5dbb25fbed065c41&dn=YouTube%20Video%20Downloader%20PRO%20FINAL%20v4.9.0.3%20%5bTechTools.NET%5d&tr=udp%3a%2f%2fopen.demonii.com%3a1337%2fannounce&tr=udp%3a%2f%2f9.rarbg.to%3a2710%2fannounce&tr=udp%3a%2f%2fcoppersurfer.tk%3a6969%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2710%2fannounce&tr=udp%3a%2f%2ftracker.istole.it%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2fglotorrents.pw%3a6969%2fannounce&tr=http%3a%2f%2fexplodie.org%3a6969%2fannounce&tr=http%3a%2f%2ftracker.nwps.ws%3a6969%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.yify-torrents.com%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=http%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2fopentracker.i2p.rocks%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.internetwarriors.net%3a1337%2fannounce&tr=udp%3a%2f%2ftracker.leechers-paradise.org%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.zer0day.to%3a1337%2fannounce\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="savepath"\r\n'
    '\r\n' +
    'C:/Users/qBit/Downloads\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="cookie"\r\n' +
    '\r\n' +
    'ui=28979218048197\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="category"\r\n' +
    '\r\n' +
    'radarr\r\n'
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="skip_checking""\r\n' +
    '\r\n' +
    'true\r\n'
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="root_folder""\r\n' +
    '\r\n' +
    'true\r\n';
return msg;

return msg; 

```

reference:

```auto
POST /api/v2/torrents/add HTTP/1.1
User-Agent: Fiddler
Host: 127.0.0.1
Cookie: SID=your_sid
Content-Type: multipart/form-data; boundary=---------------------------6688794727912
Content-Length: length

-----------------------------6688794727912
Content-Disposition: form-data; name="urls"

https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E7.torrent
https://torcache.net/torrent/3B1A1469C180F447B77021074DBBCCAEF62611E8.torrent
-----------------------------6688794727912
Content-Disposition: form-data; name="savepath"

C:/Users/qBit/Downloads
-----------------------------6688794727912
Content-Disposition: form-data; name="cookie"

ui=28979218048197
-----------------------------6688794727912
Content-Disposition: form-data; name="category"

movies
-----------------------------6688794727912
Content-Disposition: form-data; name="skip_checking"

true
-----------------------------6688794727912
Content-Disposition: form-data; name="paused"

true
-----------------------------6688794727912
Content-Disposition: form-data; name="root_folder"

true
-----------------------------6688794727912--

```

debug:

```auto
{"_msgid":"5534682ae2afb21d","method":"POST","url":"http://192.168.0.104:8080/api/v2/torrents/add","payload":"","headers":{"connection":"close","content-length":"0","date":"Thu, 06 Oct 2022 12:16:08 GMT","x-node-red-request-node":"6aee9102"},"cookies":null,"statusCode":400,"responseUrl":"http://192.168.0.104:8080/api/v2/torrents/add","redirectList":[],"retry":0,"responseCookies":{"SID":{"path":"/","SameSite":"Strict","value":"uMSZDokpbLP/O4yNtWgsF+LPXxLb50Cu"}},"cookie":"SID=uMSZDokpbLP/O4yNtWgsF+LPXxLb50Cu"}

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 12:26 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/13 "2022-10-06T12:26:10Z")

</div>

> [@boo](#):
>
> ```auto
> msg.headers = {
> "Content-Type": "multipart/form-data; boundary=---------------------------6688794727912"
> }
> msg.headers = {
> "Content-Length": "length"
> }
> msg.headers = {
> "Host": "127.0.0.1"
> }
> msg.headers = {
> "User-Agent": "Fiddler"
> }
> 
> ```

Every time you set msg.headers to a new {object} containing one item (and destroy the previous entry). Do the same as you did for `msg.headers["cookie"]`.

Also, current length needs to be a value, not a string of "length" though you might get away with leaving this particular header out.

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 12:32 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/14 "2022-10-06T12:32:18Z")

</div>

thanks let me try, msg.headers[""] or can it work like this?

```auto
msg.headers = {
    "Content-Type": "multipart/form-data; boundary=---------------------------6688794727912",
    "Content-Length": "length",
    "Host": "127.0.0.1",
    "User-Agent": "Fiddler",
}

```

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 12:40 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/15 "2022-10-06T12:40:53Z")

</div>

@Steve-Mcl even this isn't working

```auto
var y = msg.responseCookies.SID.value
var x = "SID="
var cookie = x + y

msg.url = "http://192.168.0.104:8080/api/v2/torrents/add";

msg.headers = {};
msg.method = "POST";
msg.headers["cookie"] = "cookie";
msg.headers["POST"] = "/api/v2/torrents/add HTTP/1.1";
msg.headers["Content-Type"] = "multipart/form-data; boundary=---------------------------6688794727912";
msg.headers["Host"] = "192.168.0.104:8080";
msg.cookie = cookie;
msg.payload = '-----------------------------6688794727912\r\n'+
    'Content-Disposition: form-data; name="urls"\r\n' +
    '\r\n' +
    'magnet:?xt=urn:btih:0f45480a69ff7b2e948ccfed5dbb25fbed065c41&dn=YouTube%20Video%20Downloader%20PRO%20FINAL%20v4.9.0.3%20%5bTechTools.NET%5d&tr=udp%3a%2f%2fopen.demonii.com%3a1337%2fannounce&tr=udp%3a%2f%2f9.rarbg.to%3a2710%2fannounce&tr=udp%3a%2f%2fcoppersurfer.tk%3a6969%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2710%2fannounce&tr=udp%3a%2f%2ftracker.istole.it%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2fglotorrents.pw%3a6969%2fannounce&tr=http%3a%2f%2fexplodie.org%3a6969%2fannounce&tr=http%3a%2f%2ftracker.nwps.ws%3a6969%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.yify-torrents.com%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=http%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2fopentracker.i2p.rocks%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.internetwarriors.net%3a1337%2fannounce&tr=udp%3a%2f%2ftracker.leechers-paradise.org%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.zer0day.to%3a1337%2fannounce\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="savepath"\r\n' +
    '\r\n' +
    'C:/Users/qBit/Downloads\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="cookie"\r\n' +
    '\r\n' +
    'ui=28979218048197\r\n'+
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="category"\r\n' +
    '\r\n' +
    'radarr\r\n' +
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="skip_checking""\r\n' +
    '\r\n' +
    'true\r\n' +
    '-----------------------------6688794727912\r\n' +
    'Content-Disposition: form-data; name="root_folder""\r\n' +
    '\r\n' +
    'true\r\n';
return msg;

```

same debug messsage with error 400  
when i try to check with chrome network tool it shows this when a torrent is added manually

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/e/deadee67c1d614517354649183d03124863bcf16.png)

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 13:02 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/16 "2022-10-06T13:02:33Z")

</div>

@Steve-Mcl quick progress but still does not work says error code 403 forbidden but getting better response

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/0/50b189f4aad40e0f941d32b032bd32a56a047b84.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 13:04 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/17 "2022-10-06T13:04:51Z")

</div>

> [@boo](#):
>
> 403 forbidden

did you provide username/password?

Perhaps if qTorrent lets you, turn off HTTP security till you get it working.

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 13:23 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/18 "2022-10-06T13:23:29Z")

</div>

> [@Steve-Mcl](#):
>
> did you provide username/password?

Yes in 1st function node

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/0/40ba70db0c4026f2c53ea8b8a9698cdaee620684.png)

> [@Steve-Mcl](#):
>
> Perhaps if qTorrent lets you, turn off HTTP security till you get it working.

turned off password requirement for nodered server.  
@Steve-Mcl this works with status code 200 but payload fails

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/c/dc2c070f55727365c35452f7983b9ccda6ec182b.png)

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [6 October 2022 13:27 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/19 "2022-10-06T13:27:00Z")

</div>

> [@boo](#):
>
> turned off password requirement for nodered server.  
> @Steve-Mcl this works with status code 200 but payload fails

nodered server?

what is serving `/api/v2/torrents/add`?

---

<div class="post-metadata">

**Author:** ![boo](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/boo/32/67804_2.png) [@boo](https://discourse.nodered.org/u/boo)\
**Post date:** [6 October 2022 13:29 UTC](https://discourse.nodered.org/t/need-help-in-http-request-node/68612/20 "2022-10-06T13:29:02Z")

</div>

its working now..

```auto
var y = msg.responseCookies.SID.value
var x = "SID="
var cookie = x + y

msg.url = "http://192.168.0.104:8080/api/v2/torrents/add";

msg.headers = {};
msg.method = "POST";
msg.headers["cookie"] = "cookie";
msg.headers["POST"] = "/api/v2/torrents/add HTTP/1.1";
msg.headers["Content-Type"] = "multipart/form-data; boundary=---------------------------6688794727912";
msg.headers["Host"] = "192.168.0.104:8080";
msg.cookie = cookie;
msg.payload = '-----------------------------6688794727912\r\n'+
    'Content-Disposition: form-data; name="urls"\r\n' +
    '\r\n' +
    'magnet:?xt=urn:btih:0f45480a69ff7b2e948ccfed5dbb25fbed065c41&dn=YouTube%20Video%20Downloader%20PRO%20FINAL%20v4.9.0.3%20%5bTechTools.NET%5d&tr=udp%3a%2f%2fopen.demonii.com%3a1337%2fannounce&tr=udp%3a%2f%2f9.rarbg.to%3a2710%2fannounce&tr=udp%3a%2f%2fcoppersurfer.tk%3a6969%2fannounce&tr=udp%3a%2f%2f9.rarbg.me%3a2710%2fannounce&tr=udp%3a%2f%2ftracker.istole.it%3a80%2fannounce&tr=udp%3a%2f%2ftracker.publicbt.com%3a80%2fannounce&tr=udp%3a%2f%2fglotorrents.pw%3a6969%2fannounce&tr=http%3a%2f%2fexplodie.org%3a6969%2fannounce&tr=http%3a%2f%2ftracker.nwps.ws%3a6969%2fannounce&tr=udp%3a%2f%2fexodus.desync.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.yify-torrents.com%2fannounce&tr=udp%3a%2f%2ftracker.opentrackr.org%3a1337%2fannounce&tr=http%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2fopentracker.i2p.rocks%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.internetwarriors.net%3a1337%2fannounce&tr=udp%3a%2f%2ftracker.leechers-paradise.org%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.zer0day.to%3a1337%2fannounce\r\n';
return msg;

```

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/4/04f4087a759c741213d5b768bff5116876ebfea7.png)

[Next page](https://discourse.nodered.org/t/need-help-in-http-request-node/68612.md?page=2)
