# How to make sense of the returned list of Flows from the \`/flows\` API?

**URL:** <https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245>\
**Category:** General\
**Created:** [7 May 2023 14:46 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245 "2023-05-07T14:46:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)\
**Post date:** [7 May 2023 14:46 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/1 "2023-05-07T14:46:35Z")

</div>

So I am writing an ansible collection for node-red so that one can control multiple node-red instances without writing complicated code.

For the initial test case I developed a **Lookup Plugin** that will provide me the current list of flows on an instance:

This makes the ansible playbook:

```yaml
- name: localhost
  tasks:
    - name: Get all flows from an instance
      set_fact:
         nodered_flows: "{{ lookup('nodered_flow', 'nodered_url=http://localhost/nodered nodered_user=admin nodered_password=admin') }}"

    - name: flows 
      debug: var=nodered_flows

```

Which works really nicely at the moment:

```bash
ok: [localhost] => 
  msg:
  - disabled: false
    env: []
    id: 44a1586775b5aa07
    info: ''
    label: tester_flow
    type: tab
  - crontab: ''
    id: c8695be143cd18a3
    name: ''
    once: false
    onceDelay: '5'
    payload: ''
    payloadType: date
    props:
    - p: payload
    - p: topic
      vt: str
    repeat: '10'
    topic: ''
    type: inject
    wires:
    - - 6225429b84c5b433
    x: 290
    y: 100
    z: 44a1586775b5aa07
  - active: true
    complete: 'false'
    console: false
    id: 6225429b84c5b433
    name: debug 1
    statusType: auto
    statusVal: ''
    tosidebar: true
    tostatus: false
    type: debug
    wires: []
    x: 660
    y: 120
    z: 44a1586775b5aa07

```

This essentially is the value when `Node-RED-API-Version: v2` on HTTP API `/flows` and the plugin returns `flows` list. This is nice and all, but for an end-user the resultant is not very intuitive. All the elements in the list do not give a lot of intuitive information about the flows and neither does it state which element actually provides the list a better overview of what the current state is.

---

<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:** [7 May 2023 15:23 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/2 "2023-05-07T15:23:25Z")

</div>

What were you hoping to get out?

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)\
**Post date:** [7 May 2023 15:37 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/3 "2023-05-07T15:37:36Z")

</div>

I was hoping of getting a better summary for the flow e.g. which nodes, configs, subflows etc. are available in each flow.

---

<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:** [7 May 2023 15:41 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/4 "2023-05-07T15:41:18Z")

</div>

That method, as I understand it, effectively just gives you the whole flows file contents.

---

<div class="post-metadata">

**Author:** ![Shan](https://avatars.discourse-cdn.com/v4/letter/s/7ab992/32.png) [@Shan](https://discourse.nodered.org/u/Shan)\
**Post date:** [7 May 2023 16:01 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/5 "2023-05-07T16:01:57Z")

</div>

I guess it is what it is. I tried using `/flow/global` but all it ever returns is:

```json
{
  "id": "global"
}

```

Anyways I guess there is nothing too much I can do but either show the response of save the flow locally which can serve as download flows option.

---

<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:** [7 May 2023 16:49 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/6 "2023-05-07T16:49:39Z")

</div>

All of the information you want is in the response. You just have to do some work to extract it.

1. Look for all entries with type `tab`. These are the tabs/flows in the editor. Similarly, entries with type `subflow` are the subflows.
2. For every other node, it's `z` property corresponds to the `id` of the `tab` (or `subflow`) that it is on.

If it doesn't have a `z` property, then it is a "global" config node.

---

<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:** [21 May 2023 16:50 UTC](https://discourse.nodered.org/t/how-to-make-sense-of-the-returned-list-of-flows-from-the-flows-api/78245/7 "2023-05-21T16:50:03Z")

</div>

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