# Http request problem

**URL:** <https://discourse.nodered.org/t/http-request-problem/17791>\
**Category:** General\
**Created:** [11 November 2019 11:45 UTC](https://discourse.nodered.org/t/http-request-problem/17791 "2019-11-11T11:45:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tzeeth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tzeeth/32/6825_2.png) [@tzeeth](https://discourse.nodered.org/u/tzeeth)\
**Post date:** [11 November 2019 11:45 UTC](https://discourse.nodered.org/t/http-request-problem/17791/1 "2019-11-11T11:45:33Z")

</div>

Hi Node-Red community, I have a problem that I do not find how to solve it.  
I am getting some variables from my server joining them into a msg.payload and then trying to send via HTTP request but the server does not respond.  
This is my array of variables:  
[21,31,9] -\> msg.payload  
This is my url&method & payload:  
Change node, set msg.url = url, set msg.method = post, set msg.headers = {service,content-type = text/plain} and set msg.payload = $string(payload).  
The request is as follows:  
{"payload":"temp|21#hr|31#lux|9","\_msgid":"6f19bf01.e365f","url":"http://----","method":"POST","headers":{"Service":"mine","Content-Type":"text/plain"}}  
but no response from server. Any ideas?  
EDIT, code from POSTMAN that works:

```auto
POST /iot/d?k=KEY&amp; i=sensor; HTTP/1.1
Host: IP:PPPP
Accept: application/json
Service: service
ServicePath: /Sensor
Content-Type: text/plain
User-Agent: PostmanRuntime/7.19.0
Cache-Control: no-cache
Postman-Token: ----
Host: IP:PPPP
Accept-Encoding: gzip, deflate
Content-Length: 19
Connection: keep-alive
cache-control: no-cache

temp|21#hr|31#lux|9

```

Regards!

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [11 November 2019 13:04 UTC](https://discourse.nodered.org/t/http-request-problem/17791/2 "2019-11-11T13:04:55Z")

</div>

The first think I would try is to use `curl` to send the same request from the same server where node-red is running. Something like this:

```auto
curl -v -X POST -H 'Service: mine' -H 'Content-Type: text/plain' `http://...`

```

That should give you enough feedback to know whether it's a network, DNS, router, or server issue. If that works, then you should probably post your flow so we can help debug further.

Incidentally, how do you _know_ that the server is not responding? What are you using to show the output from the service (if any)?

---

<div class="post-metadata">

**Author:** ![tzeeth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tzeeth/32/6825_2.png) [@tzeeth](https://discourse.nodered.org/u/tzeeth)\
**Post date:** [11 November 2019 13:13 UTC](https://discourse.nodered.org/t/http-request-problem/17791/3 "2019-11-11T13:13:56Z")

</div>

Hi!  
The server is working, the response I am receiving through HTTP request node.

```auto
[
    {
        "id": "e04b0f75.efce08",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": ""
    },
    {
        "id": "4db09aba.6408d4",
        "type": "join",
        "z": "e04b0f75.efce08",
        "name": "",
        "mode": "custom",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "|",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "",
        "count": "3",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 710,
        "y": 280,
        "wires": [
            [
                "4d340796.b64e88",
                "19267ce4.02a55b"
            ]
        ]
    },
     {
        "id": "b622dd82.eb625",
        "type": "http request",
        "z": "e04b0f75.efce08",
        "name": "http req",
        "method": "use",
        "ret": "txt",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "persist": true,
        "proxy": "",
        "authType": "",
        "x": 660,
        "y": 500,
        "wires": [
            [
                "9239ba5a.ee413"
            ]
        ]
    },
    {
        "id": "9239ba5a.ee413",
        "type": "debug",
        "z": "e04b0f75.efce08",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 930,
        "y": 500,
        "wires": []
    },
    {
        "id": "4d340796.b64e88",
        "type": "function",
        "z": "e04b0f75.efce08",
        "name": "",
        "func": "msg.payload= 'temp|'+msg.payload[0]+'#hr|'+msg.payload[1]+'#lux|'+msg.payload[2];,
        "outputs": 1,
        "noerr": 0,
        "x": 850,
        "y": 280,
        "wires": [
            [
                "a54f1ec9.9912d8"
            ]
        ]
    },
    {
        "id": "d994620a.ea092",
        "type": "debug",
        "z": "e04b0f75.efce08",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 510,
        "y": 640,
        "wires": []
    },
    {
        "id": "a54f1ec9.9912d8",
        "type": "change",
        "z": "e04b0f75.efce08",
        "name": "url&method",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "http://IP:PPPP/iot/d?k=KEY&i=sensor&getCmd=1",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "method",
                "pt": "msg",
                "to": "POST",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "headers",
                "pt": "msg",
                "to": "{\"Service\":\"Service\",\"Content-Type\":\"text/plain\",\"ServicePath\":\"/Sensor\"}",
                "tot": "json"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "$string(payload)\t\t",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 350,
        "y": 520,
        "wires": [
            [
                "b622dd82.eb625",
                "d994620a.ea092"
            ]
        ]
    },
    {
        "id": "19267ce4.02a55b",
        "type": "debug",
        "z": "e04b0f75.efce08",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 890,
        "y": 200,
        "wires": []
    }
]

```

This is my code, I modified some parts.  
Thanks.

---

<div class="post-metadata">

**Author:** ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)\
**Post date:** [11 November 2019 13:15 UTC](https://discourse.nodered.org/t/http-request-problem/17791/4 "2019-11-11T13:15:22Z")

</div>

Ok, that's good -- so there are no more issues?

---

<div class="post-metadata">

**Author:** ![tzeeth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tzeeth/32/6825_2.png) [@tzeeth](https://discourse.nodered.org/u/tzeeth)\
**Post date:** [11 November 2019 13:26 UTC](https://discourse.nodered.org/t/http-request-problem/17791/5 "2019-11-11T13:26:30Z")

</div>

Yes, still not work.  
By the way my full msg object is:

```auto
{"payload":"temp|21#hr|31#lux|9","_msgid":"6f19bf01.e365f","url":"http://IP:PPPP/iot/d?k=KEY&i=sensor","method":"POST","headers":{"Service":"service","Content-Type":"text/plain","ServicePath":"/Sensor"}}

```

---

<div class="post-metadata">

**Author:** ![tzeeth](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/tzeeth/32/6825_2.png) [@tzeeth](https://discourse.nodered.org/u/tzeeth)\
**Post date:** [12 November 2019 08:57 UTC](https://discourse.nodered.org/t/http-request-problem/17791/6 "2019-11-12T08:57:35Z")

</div>

EDIT: resolved, IP have a problem with DNS and that was causing to not work.
