I want to send this, only with a payload as the Playlist number:
192.168.1.4:16008/MCWS/v1/Playback/PlayPlaylist?Zone=0&ZoneType=Index&Playlist=2&PlaylistType=Path
Putting that in a HTTP request node works, both on GET and PUT. To get the playlist from the payload I input 2 from an injection node and run it through a function node:
URL1 = "/MCWS/v1/Playback/PlayPlaylist?Zone=0&ZoneType=Index&Playlist=";`
URL2 = "&PlaylistType=Path";
msg.payload = URL1+playlist+URL2;
return msg;
And then use this as the URL:
http://192.168.1.4:16008
But that doesn't work at all. I tried setting the append to query string parameters, but that just gave me "invalid payload". But the payload seems to be what I wanted to input:
"/MCWS/v1/Playback/PlayPlaylist?Zone=0&ZoneType=Index&Playlist=2&PlaylistType=Path"
Or should there not be quotes there? If I try that, it fails in the function node.
Can somebody please tell me how do I do this in a working way? Here is the full flow:
[
{
"id": "a53bb1e6.a39fc8",
"type": "inject",
"z": "b2be241794e49f01",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "2",
"payloadType": "num",
"x": 90,
"y": 80,
"wires": [
[
"67893714e22c6c1a"
]
]
},
{
"id": "e14bd1af.2df488",
"type": "http request",
"z": "b2be241794e49f01",
"name": "Playlist to JRMC",
"method": "GET",
"ret": "txt",
"paytoqs": "query",
"url": "http://192.168.1.4:16008",
"tls": "",
"persist": false,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 420,
"y": 80,
"wires": [
[
"b3e62b5a.039c7"
]
]
},
{
"id": "b3e62b5a.039c7",
"type": "debug",
"z": "b2be241794e49f01",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 670,
"y": 80,
"wires": []
},
{
"id": "67893714e22c6c1a",
"type": "function",
"z": "b2be241794e49f01",
"name": "function 1",
"func": "playlist = msg.payload;\nURL1 = \"/MCWS/v1/Playback/PlayPlaylist?Zone=0&ZoneType=Index&Playlist=\";\nURL2 = \"&PlaylistType=Path\";\nmsg.payload = URL1+playlist+URL2;\nreturn msg;\n\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 240,
"y": 80,
"wires": [
[
"e14bd1af.2df488",
"7288245b173f7193"
]
]
},
{
"id": "7288245b173f7193",
"type": "debug",
"z": "b2be241794e49f01",
"name": "debug 7",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 360,
"y": 140,
"wires": []
}
]