Why does an exported Flow's JSON structure defer to that of the HTTP Admin POST on `/flow` Request Body?

Description

I have successfully found a solution to deploy a desired flow to multiple node-RED instances on distinct hardware devices / VMs.

As a generic understanding of the complete workflow, a user develops a flow locally, and then exports it using the UI's Export Option.

Interesting enough, the exported JSON structure is an array e.g.

[
   {}, {}
]

Assuming that I wish to upload this flow on multiple devices automatically I will rely on the Node-RED HTTP Admin API POST /flow, but according to the documentation the JSON structure is completely different than the exported JSON flow.

Question: Why? and Does the UI take care of restructuring the JSON file when using the Import Flow option?

you probably want POST /flows

And the reason an export from the editor is different is because a user facing export on the editor excludes some unnecessary info (like rev number)

TIP: the easiest way to determine your requirements is to watch and inspect the network tab when making various types of changes in the editor.

Instead of exporting the flow using the editor you can make a GET to /flows. The resulting file will have the proper structure to be distributed later on via HTTP Admin POST /flows.

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