Converting joined strings to UTF-8 string

Hi there,
I am new to node red. I am using version 1.0.3. I have an application where I am trying to convert multiple data from PLC tags(int, float data type) to String by using Join node and then pushing it forward on http req node.
I get the data in string type when checked through the Debug node for Join, but the Debug node of http req says "Invalid payload". I do not have access to buffer parser node, as I saw in some topics, that node was used. Is there any other solution for this?

How do you have the http node configured?
The ‘invalid request’ msg is coming from the http node so the data in msg.payload is not valid for what ever request you are attempting. Without seeing the configuration it is hard to guess what is happening.

I am attaching the configuration of both the Join and http nodes. Here the Url is of a local server.

You are using a get request but trying to send data. Have you tried using a put?

msg.payload has to be a object to add as query string

Yes. When I use PUT or POST, I do not get any sort of response on the server. Only when I am using GET, i am getting the string on server. Attaching both instances as well.
First image shows the strings coming up empty when i use PUT/ POST function.

Secong image gives me the data, but i do not want the topic name attached with it, and also the data format should be just the values separated by a comma. eg:(1,2,3,4,5)

When I keep msg.payload as an object, i get the output as follows

<!doctype html> Welcome to XAMPP ...

here are 2 examples. One appends the query string set to msg.payload.q
the other uses mustache template to add the string to the url.

[{"id":"35ee5dc.934a3a2","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1,2,3,4,5,6","payloadType":"str","x":260,"y":3220,"wires":[["bb02f58b.6d116"]]},{"id":"bb02f58b.6d116","type":"http request","z":"b779de97.b1b46","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"{{payload}}","tls":"","persist":false,"proxy":"","authType":"","x":490,"y":3200,"wires":[["71ce21dc.3f43a"]]},{"id":"71ce21dc.3f43a","type":"debug","z":"b779de97.b1b46","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":660,"y":3300,"wires":[]},{"id":"fab3a2e1.3fa208","type":"http request","z":"b779de97.b1b46","name":"","method":"GET","ret":"txt","paytoqs":"query","url":"","tls":"","persist":false,"proxy":"","authType":"","x":380,"y":3380,"wires":[["71ce21dc.3f43a"]]},{"id":"4cc7aed6.0f8ba","type":"inject","z":"b779de97.b1b46","name":"","props":[{"p":"payload.q","v":"1,2,3,4,5,6","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":3380,"wires":[["fab3a2e1.3fa208"]]}]

Where should i use this?

you copy it, then in the node-red editor press ctrl i, paste the code and press import

If I use Join to create an object, and in http node if I append qs then I Get the data on the http in this form:

> - - [13/Sep/2021:15:25:55 +0530] "GET /?q=[object%20Object]&utc_date_time=231&speed_log=2&me_rpm=3&speed_gps=4&dist_in_manoeuvre=5&dist_in_seapass=6&dist_engine=7&time_steaming_seapass=8&time_steaming_manoeuvre=9&speed_calculated_at_slip=10&slip=11&propulsion_efficiency=12&me_turboc_rpm=13&me_rev_ctr=14&me_torque_measured=15&me_power_meaured=16&me_load=17&me_energy_measured=18&me_power_fm_consumption=19&me_torque_fm_consumption=20 HTTP/1.1" 302 - "-" "-"
> - - [13/Sep/2021:15:25:55 +0530] "GET /dashboard/ HTTP/1.1" 200 7577 "[object%20Object]&utc_date_time=231&speed_log=2&me_rpm=3&speed_gps=4&dist_in_manoeuvre=5&dist_in_seapass=6&dist_engine=7&time_steaming_seapass=8&time_steaming_manoeuvre=9&speed_calculated_at_slip=10&slip=11&propulsion_efficiency=12&me_turboc_rpm=13&me_rev_ctr=14&me_torque_measured=15&me_power_meaured=16&me_load=17&me_energy_measured=18&me_power_fm_consumption=19&me_torque_fm_consumption=20" "-"

Now i can work with this output, but i don't need the tagname in it. I require the data as 231,2,3,4,etc.

You have to give us an example of how a finished url should look.

The data should be a raw text consisting only of values, separated by a comma. Something like this:

321,2,3,4,2.3,0.0,12,31,3.2, etc.

How is that an example of the url?

we need to see what you put in browser when it works
All we know is the start of url and the data, we need to see an example of complete url

As of now, I am not putting it in any browser, but just checking it locally on XAMPP Control Panel, which is our local server.

Either way how many times do i have to ask to see a full example of the url?

I have attached the screenshot earlier. The url that I am using is this:

I will ask one last time, then i will give up in frustration.

We need to see how the url looks when put together, as your explanations are confusing and incomplete

eg http://102.153.367.23:447?somename=1,2,3,4,5,6
or http://102.153.367.23:447/1,2,3,4,5,6
or some other format

1 Like

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