Http endpoint accept only the first url parameter

Hi community
I'm new to node-red and try to config a simple http endpoint (REST API). I startet adapt with the samples from the cookbook: this one with one single parameter works fine (https://cookbook.nodered.org/http/handle-url-parameters). Now i wanted to pass 2 or more parameters. So I try to adapt this example.

But in my case it only accepts the first parameter:

api.mydomain.cloud/api/cm/v1/getdoglistbysearch?clientid=1234&query=test
api.mydomain.cloud/api/cm/v1/getdoglistbysearch?query=test&clientid=1234

I read the values with msg.req.query.query and msg.req.query.clientid

Do i have adapt the example wrong with 2 or more parameters?
Daniel

The example from the link you shared works fine for me
Can you share your flow ?

This is the test flow i used making a request to https://<NR_IP>:1880/hello?clientid=1234&query=test

image

[{"id":"b34dd1af.4cb23","type":"template","z":"54efb553244c241f","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        <h1>{{req.query.clientid}}</h1>\n        <h1>{{req.query.query}}</h1>\n    </body>\n</html>","x":450,"y":3160,"wires":[["b828f6a6.47d708","de991bfdb1b2b39d"]]},{"id":"1052941d.efad6c","type":"http in","z":"54efb553244c241f","name":"","url":"/hello","method":"get","upload":false,"swaggerDoc":"","x":300,"y":3160,"wires":[["b34dd1af.4cb23"]]},{"id":"b828f6a6.47d708","type":"http response","z":"54efb553244c241f","name":"","statusCode":"","headers":{},"x":630,"y":3160,"wires":[]},{"id":"de991bfdb1b2b39d","type":"debug","z":"54efb553244c241f","name":"debug 76","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"req.query","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":3220,"wires":[]}]

Thanks for the food for thought. I went through all the nodes again and found the error in the two switch nodes that check the validity of the parameters. I can now read the parameters correctly with rec.query.parametername. And it works.

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