Adding parameters of Api in HTTP Request Node

Below Flow is for calling API In that i have added the dateTime parameter i have written function but i am getting as error not able to call the parameters of API
[
{
"id": "b34765c4163ec6fe",
"type": "tab",
"label": "Rest API",
"disabled": false,
"info": "",
"env":
},
{
"id": "1f20e2b49a5883ee",
"type": "inject",
"z": "b34765c4163ec6fe",
"name": "Query Parameter",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": " dateTime",
"payload": "",
"payloadType": "date",
"x": 180,
"y": 100,
"wires": [
[
"dd3e4b46106047ba",
"7dd86e710129a958"
]
]
},
{
"id": "6e0c72d1e28b47dc",
"type": "http request",
"z": "b34765c4163ec6fe",
"name": "",
"method": "POST",
"ret": "txt",
"paytoqs": "ignore",
"url": "http://192.168.1.9:1301/api/OmronTagData/OmronTagdata?TagID=1&TagValue=\"+msg.payload+\"&dateTime=03-12-2021 13:00:00",
"tls": "",
"persist": true,
"proxy": "",
"authType": "bearer",
"senderr": false,
"x": 570,
"y": 60,
"wires": [
[
"5573231dec4d023d"
]
]
},
{
"id": "5573231dec4d023d",
"type": "debug",
"z": "b34765c4163ec6fe",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 750,
"y": 100,
"wires":
},
{
"id": "dd3e4b46106047ba",
"type": "function",
"z": "b34765c4163ec6fe",
"name": "",
"func": "msg.topic=new Date();\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 360,
"y": 60,
"wires": [
[
"6e0c72d1e28b47dc"
]
]
},
{
"id": "160701bd3b119d62",
"type": "function",
"z": "b34765c4163ec6fe",
"name": "",
"func": "\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": ,
"x": 520,
"y": 140,
"wires": [
[
"6e0c72d1e28b47dc"
]
]
},
{
"id": "7dd86e710129a958",
"type": "change",
"z": "b34765c4163ec6fe",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 380,
"y": 240,
"wires": [
[
"160701bd3b119d62"
]
]
}
]

There are some examples of how to use the HTTP Request in the Node-red Cookbook

https://cookbook.nodered.org/#http-requests

how to add the datetime parameter of API to make it dynamic

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

You are clearly new to node-red so I will include some extra info for you at the end but first, your issues...

You cannot evaluate strings in a field...
image

You can however use mustache syntax as is detailed in the built in help...

image

e.g...
http://192.168.1.9:1301/api/OmronTagData/OmronTagdata?TagID={{TagID}}&TagValue="{{TagValue}}"&dateTime={{dateTime}}

NOTE for this :point_up_2: to work, you would need to set msg.TagID, msg.TagValue and msg.dateTime in the msg that goes to the HTTP-Request node

your current flow will cause the HTTP-Request to be executed twice

A head start...

try importing this demo flow

[{"id":"1f20e2b49a5883ee","type":"inject","z":"b34765c4163ec6fe","name":"","props":[],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":150,"y":100,"wires":[["7dd86e710129a958"]]},{"id":"6e0c72d1e28b47dc","type":"http request","z":"b34765c4163ec6fe","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://192.168.1.9:1301/api/OmronTagData/OmronTagdata?TagID={{TagID}}&TagValue=\"{{TagValue}}\"&dateTime={{dateTime}}","tls":"","persist":true,"proxy":"","authType":"bearer","senderr":false,"x":570,"y":100,"wires":[["5573231dec4d023d"]]},{"id":"5573231dec4d023d","type":"debug","z":"b34765c4163ec6fe","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":750,"y":100,"wires":[]},{"id":"7dd86e710129a958","type":"change","z":"b34765c4163ec6fe","name":"","rules":[{"t":"set","p":"TagID","pt":"msg","to":"1","tot":"num"},{"t":"set","p":"TagValue","pt":"msg","to":"77","tot":"num"},{"t":"set","p":"dateTime","pt":"msg","to":"$moment($now()).format(\"YYYY-MM-DD HH:mm\")\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":100,"wires":[["d1850a61c7fa64d9","6e0c72d1e28b47dc"]]},{"id":"d1850a61c7fa64d9","type":"debug","z":"b34765c4163ec6fe","name":"Check msg.TagID and msg.dateTime ","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":390,"y":160,"wires":[]}]


Canned test / help for those new to node-red...


I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.


See this article in the cookbook for an example of how to join messages into one object.


There’s a great page in the docs (Working with messages : Node-RED) that will explain how to use the debug panel to find the right path to any data item.

Pay particular attention to the part about the buttons that appear under your mouse pointer when you over hover a debug message property in the sidebar.

BX00Cy7yHi


In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

Thank you for helping me out ..its working now!