How to create a flow dynamically given a tree structure

I have a Java web application with tree data structures in XML, by pressing a button I want it to open the Node-RED editor page and have it display a flow containing function nodes with the same "structure" of the chosen tree and predetermined JavaScript code inside. To give and example, if I have select a tree with just a root node and 2 children and press the "export to Node-RED" button I would like the result to be the following:

Is there an API that can help me with this ? Is there a way to generate the JSON flow before opening up the editor ?

Hi and welcome to the forum.

At the top of this page is a link to the documentation, on that page you would find a link to to API references, on that page is a link to Admin http API.

You will have to write some code to generate your flow.json of course. Or if you structure your xml you may be able to pass it through the xml node, then a json node to generate a JSON. You could set up a http endpoint flow to possibly do this for you.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.