Curl Post new flow

Hey, I'm trying to create new flow tabs on my Node-red but i keep getting this error message.
"Error: missing nodes property"

  1. How are you doing this?
  2. What version of node-red and node.js?
  3. What device and os are you using?
  4. Are you using Docker or HomeAssistant?

The payload format for the /flow API is different to the one used by the /flows API.

Check the docs for details: POST /flow : Node-RED

Or do a GET on /flow/<insert a flow id> to see what it looks like.

I'm currently using node.js v16.17.0, node-red v3.0.2.
OS - linux 5.15.0-56-generic X64 LE.

I'm currently running linux in a virtual box, I opened the VM in order to access it in my windows operating system. When I do POST to /flows i can create flows with the content that i have exported from a flow in the dashboard.

I haven't found/was able to put it working the creation of new tabs. I can only override them into the project.

I was able to work with POST/flows, GET/flows, GET/flows/id. My doubt is what is necessary to create an extra tab on my project and inject a new flow in it from start.

I'm a bit in the dark here.

Thanks for the patience,
Rui Reis.

P.S, the url in the picture is the id associated with the Virtual machine.

I got the following codes that enable me to do the following

POST/flows creates 3 empty tabs.

GET/flows gives me the JSON code of all flows in the project.

GET/flow/id - gives me the information of a specific flow(tab).

I've already looked at that page multiple times. Isn't the POST/flow supposed to create a new tab if the ID is different from the ones that I have?

Also the PUT/flow/id, shouldn't inject a flow to the tab that i tell it to? Considering for example. id=1. If i do a PUT/FLOW/1 and in the --data-raw '(information for the flow)', shouldn't it inject that information on that tab?

What usually happens when i do this is a "bug" that removes the name of the tab(Sheet name) and doesn't inject any type of flow created + doesn't let me delete that new tab. I have to do a new POST/flows to recreate the tabs previously created.

As I said, your original screenshot shows you are using the wrong data format for the /flow end point.

You are posting an array - it should be a single object.

Until you fix that, it's hard to say what behaviours you'll see.

Thanks! I was able to create the new page, but it seems like placing an id it's redundant because it creates a new flow with a new id. How can I set a specific ID for it?

Best regards,
Rui Reis.

The API does not support that. It will always assign a new id for the flow.

It's one of many area the API could be improved in.

So in the example of POST/FLOW what does the id parameter do?
It's a bit confusing since there is created a new id

Can anyone let me know what I'm doing wrong in this scenario? I can do the post data with a simple example from reqbin but it does not work in here.
If I could get some lights in this, I would appreciate it!!

Best Regards,
Rui Reis.

What do the Node-RED logs say when you make this request?

You don't need to be providing a z property in the object you are passing in.

The original requirement for the API was to be able to add multiple copies of a flow (with some customisation made to each instance). For convenience, it was chosen to regenerate the id of the flow so that the user wouldnt have to do so themselves.

This is the error that shows when i try to post the information there.
By providing Z don't i force a global id to that flow no matter what random id it gets?

Best Regards,
Rui Reis.

Not sure what you mean. Flows do not have a z property. I don't think providing a z value makes any difference. The flow will get a new id assigned to it. There is no way for you to change that behaviour until we add a way to do it in the API.

The message in that error is fairly clear; you are not posting valid json.

Yeah, seems like it doesn't not accept spaces in the json string.

Is there a way to do a get of the payload value from the message i inject in the debugger?

You can delete msg.payload, if that is what you mean.


I was asking if there was a way via GET to attain the current content in the debugger that i injected in it.

Or do I have to use http request to post that information in a blank page to get that content?

Your questions are not entirely clear (I think you are asking how to read YOUR entry in the debug panel from outside node-red?) - even if I have read that correctly, I am not certain it is related to your original post.

It would probably be wise to start a new thread with a meaningful title & posted n the correct sectoion to attract the right users to help you.

  • Post in #general for general flow programming and node questions
  • Post in #development for help with things like CORE Node-RED APIS and CORE Node-RED design questions

It accepts any valid json. So there must be something wrong with the JSON you are sending. It's been a long time since I've used Java but it feels like there ought to be a more convenient way to write a string to the request?

No. There is no connection between the admin API and the debug sidebar.

I'd suggest you use a service like to create a fake endpoint to post your data to and inspect it.

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