Please don't cross-post the same question in multiple places.
You've already asked this in your existing thread here: What is the published format for storing NodeRED graph to a file? - #8 by raid2light
The Admin API is a programming API. In this instance, it's an API that is called by properly formed HTTP Requests. So to invoke it from the command-line, you'd need to use something like curl
or wget
to make the requests.
In the following examples, I'm assuming you do not have adminAuth
setup - so the end points are not secured. If you are using adminAuth
to secure them, you'd have to follow the guide in the docs for getting authenticated: Authentication : Node-RED
To get the current flow configuration, you'd do a GET request to /flows
:
curl http://localhost:1880/flows -s -o /tmp/flows.json
# -s : silent mode
# -o /tmp/flows.json : write the flow config to the file /tmp/flows.json
With that done, you can edit the flows.json file however you want. Once you've made your changes, you can POST it back to /flows
:
curl -XPOST -H "Content-Type: application/json" --data "@/tmp/flows.json" http://localhost:1880/flows
# -XPOST : make a POST request
# -H "..." : set the content-type header to application/json
# --data "@..." : use the contents of `/tmp/flows.json` as the body of the request