REST API pass path variable

Hey, I have one problem with Im struggling for a few hours already...I was searching on forums, documentation and I dont have any idea...

I would like to invoke rest api with dynamic param in url like:

http://someIP/dooperation/{{operation}}

I added function block with given code:

msg.operation = "test operation";

return msg;

but its not working... please help me how to resolve this problem... Thank you!

@matstrat , assuming you are using the HTTP Request node to send a request to api, make sure the Function node is properly connected to the HTTP Request node. Try moving the Function node or adding a Debug node to the output of the Function node to verify the value of msg.operation.
Below is an example that demonstrates how to include parameters with dynamic values in the URL:

[{"id":"55c4ba82b1cda801","type":"inject","z":"90fbb6d8dccbaf14","name":"Get post ","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":120,"y":240,"wires":[["772dafe6e6cb8645"]]},{"id":"0c9e2961faad145e","type":"http request","z":"90fbb6d8dccbaf14","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://jsonplaceholder.typicode.com/posts/{{id}}","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[],"x":490,"y":240,"wires":[["f8a2726943b74244"]]},{"id":"f8a2726943b74244","type":"debug","z":"90fbb6d8dccbaf14","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":740,"y":240,"wires":[]},{"id":"772dafe6e6cb8645","type":"function","z":"90fbb6d8dccbaf14","name":"function 1","func":"msg.id = 1\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":240,"wires":[["0c9e2961faad145e"]]}]

For more information on the HTTP Request node, Function node, or other core nodes, refer to the our documentation.