Executing JSON flow from terminal

I have JSON file for my flow created using GUI. From next time I don't want to use GUI for triggering this flow as what I need is I should be able to trigger this json from terminal using flow ID and whatever output I was getting in debug console that should be printed in terminal only.

I have seen Run a flow without running the GUI editor or opening a port this post also but didn't got the exact outcome.

Just add http-in/http-response nodes to the start/end of the flow and use curl to trigger and pass in any variables needed.

No. I can't use these nodes. I want normal flow on the GUI then I save that in form and json and this I should be able to trigger this flow using terminal only, then if I want to change anything in the flow I will make it through GUI and again save the json. So I need terminal methods/controls to trigger the flow.

Yes, that is what I described.

If you want to trigger the flow, you need to include an external input. I suggested HTTP because that is the easiest, but it could have been MQTT (using the mosquitto cmd line tools e.g. mosquitto_pub).

In theory you can trigger the inject node with curl as well if you know the node id, but that is way more complicated and needs you to get hold of adminAPI tokens if you have locked down the editor, and I'm not sure it will work if you have disabled the editor as I think that end point is bound to the adminHttpRoot.

@atmar If what you are looking is a command-line way of "clicking" on your behalf on the "ingest" node, then AFAIK, that doesn't exist
You need to add a node that can be triggered externaly which includes for exemple:

  • http-in like hardillb suggested tha can be triggered by curl or wget
  • mqtt-in if you have MQTT broker
  • there are some watchfolder nodes that can monitor for new files to be added in a folder....

Why wouldn't you be able to use theses nodes ?
How is your flow triggered currently ?

just to be clear, lets take simplest example as below,
image
this flow gives json result in file similar to below snapshot,


I want to take this json file and execute using terminal and the output 'Hello World' should be displayed in terminal only, meaning whenever I want to execute this flow I don't want to go to GUI and click on input to get result in it's console tab there. Also there should not be any nodes (http-in/response) attached prior or after than the actual flow.
Hope this will help and you will get my issue.

That's not possible, there is no way to execute a flow like that.

The Node-RED runtime is not intended to run one shot flows, it is intended to run continuously and trigger flows based on incoming events.