POST flow id is getting ignored

I am trying to create new flow with pre define id that I have created.

But using Node-Red API setting the id in post flow it is getting ignored.

To reproduce (I use Postman) create post request to http://localhost:1880/flow with raw JSON body

{
  "id": "aabb",
  "label": "Flow 14",
  "nodes": [ ],
  "configs": [ ]
}

After sending request the flow-id will be different than aabb, in my case it was 633ddecdd201819b.

Is there a way to set the id of the flow when it is being created?, I don't think this is a bug since the post flow API is stating

The runtime will assign a new id for the flow. If the provided flow configuration object includes an id field it will be replaced and the z property of all nodes updated to match.

which I don't understand why so posting the reason is also welcomed.

No. The current API does what it says - it generates a new id and doesn't provide an option to do otherwise.

The whole /flow api has needed some attention for a while - but as it isn't used by the core editor, it doesn't looked at much other than when people such as yourself asks questions about it.

The reason for its behaviour was the original use-case for being able to quickly add multiple copies of the same flow without having to modify all the ids manually.

1 Like

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