# REST API pass path variable

**URL:** <https://discourse.nodered.org/t/rest-api-pass-path-variable/93657>\
**Category:** Dashboard\
**Created:** [3 December 2024 11:05 UTC](https://discourse.nodered.org/t/rest-api-pass-path-variable/93657 "2024-12-03T11:05:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![matstrat](https://avatars.discourse-cdn.com/v4/letter/m/f6c823/32.png) [@matstrat](https://discourse.nodered.org/u/matstrat)\
**Post date:** [3 December 2024 11:05 UTC](https://discourse.nodered.org/t/rest-api-pass-path-variable/93657/1 "2024-12-03T11:05:41Z")

</div>

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}](http://someIP/dooperation/%7B%7Boperation%7D)}

I added function block with given code:

```auto
msg.operation = "test operation";

return msg;

```

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

---

<div class="post-metadata">

**Author:** ![sumitshinde-84](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/sumitshinde-84/32/83795_2.png) [@sumitshinde-84](https://discourse.nodered.org/u/sumitshinde-84)\
**Post date:** [3 December 2024 11:38 UTC](https://discourse.nodered.org/t/rest-api-pass-path-variable/93657/2 "2024-12-03T11:38:47Z")

</div>

@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:

```auto
[{"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](https://flowfuse.com/node-red/core-nodes/).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 January 2025 11:39 UTC](https://discourse.nodered.org/t/rest-api-pass-path-variable/93657/3 "2025-01-02T11:39:27Z")

</div>

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