# Curl Post new flow

**URL:** https://discourse.nodered.org/t/curl-post-new-flow/72275
**Category:** General
**Created:** [15 December 2022 17:58 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275 "2022-12-15T17:58:52Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [15 December 2022 17:58 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/1 "2022-12-15T17:58:52Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/c/0c66711634e476a38c2ade86230fd613c35ba375.png)

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [15 December 2022 20:58 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/2 "2022-12-15T20:58:47Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [15 December 2022 21:15 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/3 "2022-12-15T21:15:51Z")

</div>

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](https://nodered.org/docs/api/admin/methods/post/flow/)

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

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [16 December 2022 12:34 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/4 "2022-12-16T12:34:47Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/0/e044c06c6b49f74be96c76ebc1939d11a1c93a24.png)

POST/flows creates 3 empty tabs.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/675a1b88a1d1214904ffefb5a7dcf60349bb1862.png)

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).

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [16 December 2022 12:40 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/5 "2022-12-16T12:40:06Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [16 December 2022 13:04 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/6 "2022-12-16T13:04:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [16 December 2022 13:48 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/7 "2022-12-16T13:48:53Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [16 December 2022 14:06 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/8 "2022-12-16T14:06:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [16 December 2022 15:59 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/9 "2022-12-16T15:59:19Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [19 December 2022 12:40 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/10 "2022-12-19T12:40:36Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/4/24aa4ec4dafd13986f69de6810e95fdc9e8623ab.png)  
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.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [19 December 2022 15:11 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/11 "2022-12-19T15:11:24Z")

</div>

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.

> [@ruireis97](#):
>
> in the example of POST/FLOW what does the id parameter do?

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.

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [19 December 2022 15:32 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/12 "2022-12-19T15:32:58Z")

</div>

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/5/65a1e8753e7a09159b8745dcaf5c4fc87b88335e.png)  
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.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [19 December 2022 16:18 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/13 "2022-12-19T16:18:49Z")

</div>

> [@ruireis97](#):
>
> By providing Z don't i force a global id to that flow no matter what random id it gets?

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.

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [19 December 2022 17:23 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/14 "2022-12-19T17:23:56Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [19 December 2022 20:32 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/15 "2022-12-19T20:32:18Z")

</div>

> [@ruireis97](#):
>
> 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.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/7/87ecf2be180ccb196bc7cd9d0942d2f2cc836306.png)

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [20 December 2022 10:41 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/16 "2022-12-20T10:41:34Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ruireis97](https://avatars.discourse-cdn.com/v4/letter/r/87869e/32.png) [@ruireis97](https://discourse.nodered.org/u/ruireis97)
#### Post date: [20 December 2022 10:42 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/17 "2022-12-20T10:42:04Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [20 December 2022 14:14 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/18 "2022-12-20T14:14:15Z")

</div>

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

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [20 December 2022 23:35 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/19 "2022-12-20T23:35:34Z")

</div>

> [@ruireis97](#):
>
> , seems like it doesn't not accept spaces in the json string.

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?

> [@ruireis97](#):
>
> Is there a way to do a get of the payload value from the message i inject in the debugger?

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

I'd suggest you use a service like [https://requestbin.com/](https://requestbin.com/) to create a fake endpoint to post your data to and inspect it.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [18 February 2023 23:35 UTC](https://discourse.nodered.org/t/curl-post-new-flow/72275/20 "2023-02-18T23:35:39Z")

</div>

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