Http output from msg.payload

Hallo,
is it easy possible to get msg.payload from my flows as a http output like this (from my wallbox):

12

without installing a webserver or similar :grimacing:

greetings

Yes, a simple example is here
https://cookbook.nodered.org/http/create-an-http-endpoint

or if you want to make a request here is another example
https://cookbook.nodered.org/http/simple-get-request

I already saw this example, but it doesn't help me :unamused:

How do I get a msg.payload in it ?

<html>
    <head></head>
    <body>
        <h1>global.SoC</h1>
    </body>
</html>

just write "global.SoC"

edit:
got it with the global:

<html>
    <head>{{global.SoC}}</head>
</html>

can I get msg.payload without global or flow ?

maybe you can explain what is the difference between:

grafik

grafik

To use msg.payload just drop the msg. So {{payload}}

That is the output so if you want the template as msg.payload, select msg and type payload

1 Like

thank you.

the device who should read the http doesnĀ“t except the url/value.
the info says:

Valid values are full url. The requested url must return a pure number. If the return value contains something other than "-" (for infeed) or "0-9", the value is set to zero. The value must be in watts.

IĀ“m not sure if the http out is a string or a number.

firefox says:
grafik

or is the problem the port (:1880) in the url :roll_eyes:

I think the port can not be bypassed => url without :1880 ?

does not matter as all numbers and strings are sent as strings.

You will need to remove the html from the template and just have {{payload}} in the template no other text

1 Like

thank you again, now it is accepted

last question for today:

grafik

the response always has to be empty ?
I don't understand the point of this node.

Not always, some times you need to send headers in the response, or alter the status code, or delete cookies.

The http in node creates a msg.res, which is passed to the response node. This will contain standard response code, headers and other information and the response url.

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