# Link in node not working when the flow is created with Admin HTTP API

**URL:** <https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509>\
**Category:** General\
**Created:** [13 March 2023 12:43 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509 "2023-03-13T12:43:44Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![pollivier](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pollivier](https://discourse.nodered.org/u/pollivier)\
**Post date:** [13 March 2023 12:43 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/1 "2023-03-13T12:43:44Z")

</div>

Hi,  
I'm using the Admin HTTP API to create new flows automatically. Those flows contain a "link in" node linked to my main flow. But when the flow is created, the link node is not workin even if it's written that it is connected the "link out" node. The communication only work when I deploy the flow again.

Is there anyway to make this communication work without having to deploy the flow manually ?

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [13 March 2023 16:07 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/2 "2023-03-13T16:07:21Z")

</div>

You will probably need to show actual examples of how you are driving the Admin API and the JSON you are sending.

---

<div class="post-metadata">

**Author:** ![pollivier](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pollivier](https://discourse.nodered.org/u/pollivier)\
**Post date:** [14 March 2023 08:59 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/3 "2023-03-14T08:59:47Z")

</div>

This is the javascript that I'm using to create the JSON to send to an HTTP REQUEST node :

```auto
var id = [];
var idArray = [];
for (var j=0;j<4;j++){
    for (var i=0;i<8;i++) {
        idArray.push(Math.round(0xff*Math.random()).toString(16).padStart(2,'0'));
        id[j] = idArray.join("");
        idArray = [];
    }
}

const object = {
    "id": "91ad451.f6e52b8",
    "label": "Node",
        "nodes": [
        {
            "id": id[0],
            "type": "link in",
            "z": "4d1a38f1fc91f648",
            "name": "Receiver",
            "links": [
                "23c2ad085d6e61db"
            ],
            "x": 1065,
            "y": 820,
            "wires": [
                [
                    id[1]
                ]
            ]
        },
        {
            "id": id[1],
            "type": "ui_text",
            "z": "4d1a38f1fc91f648",
            "group": "f2fc2a1c6529e16e",
            "order": 0,
            "width": 0,
            "height": 0,
            "name": "",
            "label": "text",
            "format": "{{msg.payload}}",
            "layout": "row-spread",
            "className": "",
            "x": 1270,
            "y": 820,
            "wires": []
        },
        {
            "id": id[2],
            "type": "ui_group",
            "name": "Test",
            "tab": "bef57110583eb196",
            "order": 1,
            "disp": false,
            "width": "6",
            "collapse": false,
            "className": ""
        },
        {
            "id": id[3],
            "type": "ui_tab",
            "name": "Home",
            "icon": "dashboard",
            "disabled": false,
            "hidden": false
        }
    ]
}
msg.payload = object;
return msg;

```

And this create a flow like that :  
 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/5/d583a2e088048e6909309e23a018f3c7cd80cadf.png)

And when I try to send information with the link node I can't receive anything in the new flow. And if i move a node to be able to deploy the changes, then it work.

---

<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:** [14 March 2023 09:17 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/4 "2023-03-14T09:17:28Z")

</div>

Which Admin Api are you sending that to?

Based on the format of the JSON, I'm guessing you are passing that to the `/flow` endpoint to add this as a new flow?

I can see you have a link pre-configured in the `link in` node - I assume that is an attempt to connect it to an existing `link out` node you already have?

I _think_ the issue will be that the `link out` node isn't also being updated to tell it about the new node you want it to connect to.

When you do this in the editor, the editor takes care of updating both the `link in` _and_ `link out` node configurations to match. Just importing the new flow containing the `link in` node won't touch the existing `link out` node.

---

<div class="post-metadata">

**Author:** ![pollivier](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pollivier](https://discourse.nodered.org/u/pollivier)\
**Post date:** [14 March 2023 09:38 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/5 "2023-03-14T09:38:48Z")

</div>

> [@knolleary](#):
>
> Which Admin Api are you sending that to?

I'm using the Admin HTTP API with POST /flow.

> [@knolleary](#):
>
> I can see you have a link pre-configured in the `link in` node - I assume that is an attempt to connect it to an existing `link out` node you already have?

Exactly, I have a existing `link out` node that need to communicate with all the new flows created.

> [@knolleary](#):
>
> I _think_ the issue will be that the `link out` node isn't also being updated to tell it about the new node you want it to connect to.

Yes, you're right, when I reload only the flow containing the `link out` node the communication work.

So is there a solution to reload only this flow without using the editor ?

---

<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:** [14 March 2023 09:50 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/6 "2023-03-14T09:50:22Z")

</div>

Maybe you could

- Pre-link the link out to a link in on a temporary tab
- note the ID of the temporary TAB and the link-in node
- generate the /flow with the same IDs to replace the existing temporary flow

---

<div class="post-metadata">

**Author:** ![pollivier](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pollivier](https://discourse.nodered.org/u/pollivier)\
**Post date:** [14 March 2023 10:22 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/7 "2023-03-14T10:22:22Z")

</div>

I don't think this solution will work if I want to add multiples flows

---

<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:** [14 March 2023 10:26 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/8 "2023-03-14T10:26:39Z")

</div>

No, it would not.

Alternatively, then, use MQTT.

Subscribe to the same topic. Your main (static) flow would simply publish to that topic and any subscribers would be notified.

---

<div class="post-metadata">

**Author:** ![pollivier](https://avatars.discourse-cdn.com/v4/letter/p/f475e1/32.png) [@pollivier](https://discourse.nodered.org/u/pollivier)\
**Post date:** [15 March 2023 08:03 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/9 "2023-03-15T08:03:52Z")

</div>

Thank you that's a good idea and it work very well !

---

<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:** [29 March 2023 08:04 UTC](https://discourse.nodered.org/t/link-in-node-not-working-when-the-flow-is-created-with-admin-http-api/76509/10 "2023-03-29T08:04:08Z")

</div>

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