Deploying node-red streams from... node-red

For example periodic deployment - once a day

[{"id":"905576c935e3c8fc","type":"debug","z":"38f2824d4f518663","name":"results","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":958,"y":696,"wires":[]},{"id":"604323c9973268ab","type":"inject","z":"38f2824d4f518663","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"00 03 * * *","once":false,"onceDelay":0.1,"topic":"","payload":"true","payloadType":"bool","x":218,"y":696,"wires":[["3349f2add87bda77"]]},{"id":"3349f2add87bda77","type":"function","z":"38f2824d4f518663","name":"request","func":"msg.url = \"http://localhost:1880/auth/token\";\nmsg.method = 'POST';\nmsg.payload = {\n    \"client_id\": \"node-red-editor\",\n    \"grant_type\": \"password\",\n    \"username\": \"******\",\n    \"password\": \"******\",\n    \"scope\": \"*\"\n};\nreturn msg;\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":348,"y":696,"wires":[["e4dbc5d89e266b62"]]},{"id":"e4dbc5d89e266b62","type":"http request","z":"38f2824d4f518663","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{},"x":498,"y":696,"wires":[["40a1789a6e4767be"]]},{"id":"40a1789a6e4767be","type":"function","z":"38f2824d4f518663","name":"request","func":"var auth = msg.payload.access_token;\nmsg.url = 'http://localhost:1880/flows';\nmsg.method = 'POST';\nmsg.headers = {};\nmsg.headers['content-type'] = \"application/json; charset=utf-8\";\nmsg.headers['Node-RED-Deployment-Type'] = \"reload\";\nmsg.headers['Node-RED-API-Version'] =  \"v2\";\nmsg.headers['Authorization'] = \"Bearer \"+ auth;\nmsg.payload = {};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":648,"y":696,"wires":[["b3249a2ec340dd72"]]},{"id":"b3249a2ec340dd72","type":"http request","z":"38f2824d4f518663","name":"","method":"use","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"credentials":{},"x":798,"y":696,"wires":[["905576c935e3c8fc"]]},{"id":"79ec98d910e96190","type":"comment","z":"38f2824d4f518663","name":"Deploying node-red streams from... node-red","info":"Periodic deployment - once a day","x":398,"y":636,"wires":[]}]

Flow Info

Created 3 years ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • comment (x1)
  • debug (x1)
  • function (x2)
  • http request (x2)
  • inject (x1)

Tags

  • autodeploying
  • deploying
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option