# Edit nodes by API Methods, help me!

**URL:** <https://discourse.nodered.org/t/edit-nodes-by-api-methods-help-me/42474>\
**Category:** General\
**Created:** [11 March 2021 11:25 UTC](https://discourse.nodered.org/t/edit-nodes-by-api-methods-help-me/42474 "2021-03-11T11:25:57Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![d0d04m3](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/d0d04m3/32/19965_2.png) [@d0d04m3](https://discourse.nodered.org/u/d0d04m3)\
**Post date:** [11 March 2021 13:22 UTC](https://discourse.nodered.org/t/edit-nodes-by-api-methods-help-me/42474/3 "2021-03-11T13:22:42Z")

</div>

ok I updated with  
`PUT /flow/:id`

```auto
[
    {
        "id": "9755354.1a5d8c8",
        "type": "tab",
        "label": "Test"
    },
    {
        "id": "455936c5.4dc638",
        "type": "tab",
        "label": "Flow 2"
    },
    {
        "id": "7d21e8fc.4809e8",
        "type": "persist-store",
        "filename": "./persistence.json",
        "interval": "60"
    },
    {
        "id": "45b295b1.0045cc",
        "type": "function",
        "z": "9755354.1a5d8c8",
        "name": "request",
        "func": "msg.url = 'http://localhost:1880/red/flows';\nmsg.method = 'POST';\nmsg.headers = {};\nmsg.headers['content-type'] = \"application/json; charset=utf-8\";\nmsg.headers['Node-RED-Deployment-Type'] = \"reload\";\nmsg.headers['Node-RED-API-Version'] = \"v2\";\nmsg.payload = {\n \"flows\": [\n {\n \"type\": \"tab\",\n \"id\": \"9755354.1a5d8c8\",\n \"label\": \"Test\"\n }\n]\n};\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 320,
        "y": 60,
        "wires": [
            [
                "cd0b9552.5f3be8"
            ]
        ]
    },
    {
        "id": "2a590784.f7a868",
        "type": "debug",
        "z": "9755354.1a5d8c8",
        "name": "results",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 670,
        "y": 60,
        "wires": []
    },
    {
        "id": "38dbceb9.0b5482",
        "type": "inject",
        "z": "9755354.1a5d8c8",
        "name": "reload TAB",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 140,
        "y": 60,
        "wires": [
            [
                "45b295b1.0045cc"
            ]
        ]
    },
    {
        "id": "cd0b9552.5f3be8",
        "type": "http request",
        "z": "9755354.1a5d8c8",
        "name": "",
        "method": "use",
        "ret": "txt",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 510,
        "y": 60,
        "wires": [
            [
                "2a590784.f7a868"
            ]
        ]
    },
    {
        "id": "4fd571c0.a666f",
        "type": "inject",
        "z": "9755354.1a5d8c8",
        "name": "",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "string"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 190,
        "y": 200,
        "wires": [
            [
                "f1187019.7b86b"
            ]
        ]
    },
    {
        "id": "f1187019.7b86b",
        "type": "debug",
        "z": "9755354.1a5d8c8",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 400,
        "y": 200,
        "wires": []
    },
    {
        "id": "a5f64e62.b2892",
        "type": "function",
        "z": "9755354.1a5d8c8",
        "name": "request",
        "func": "msg.url = 'http://localhost:1880/red/flow/455936c5.4dc638';\nmsg.method = 'GET';\nmsg.headers = {};\nmsg.headers['content-type'] = \"application/json; charset=utf-8\";\nmsg.headers['Node-RED-API-Version'] = \"v2\";\nmsg.payload = \"\"\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 260,
        "y": 100,
        "wires": [
            [
                "45bbbde1.fb50c4"
            ]
        ]
    },
    {
        "id": "4823faa6.7cb694",
        "type": "debug",
        "z": "9755354.1a5d8c8",
        "name": "results",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 730,
        "y": 100,
        "wires": []
    },
    {
        "id": "fd389bb5.116958",
        "type": "inject",
        "z": "9755354.1a5d8c8",
        "name": "GET TAB",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "x": 100,
        "y": 100,
        "wires": [
            [
                "a5f64e62.b2892"
            ]
        ]
    },
    {
        "id": "45bbbde1.fb50c4",
        "type": "http request",
        "z": "9755354.1a5d8c8",
        "name": "",
        "method": "use",
        "ret": "txt",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 410,
        "y": 100,
        "wires": [
            [
                "2a8f791b.c3c2f6"
            ]
        ]
    },
    {
        "id": "2a8f791b.c3c2f6",
        "type": "json",
        "z": "9755354.1a5d8c8",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 550,
        "y": 100,
        "wires": [
            [
                "4823faa6.7cb694",
                "2978dd3a.719f42"
            ]
        ]
    },
    {
        "id": "2978dd3a.719f42",
        "type": "function",
        "z": "9755354.1a5d8c8",
        "name": "Update",
        "func": "msg.url = 'http://localhost:1880/red/flow/455936c5.4dc638';\nnodes = msg.payload.nodes\nnodes[0].name = \"demo3\"\nmsg.method = 'PUT';\nmsg.headers = {};\nmsg.headers['content-type'] = \"application/json; charset=utf-8\";\nmsg.headers['Node-RED-API-Version'] = \"v2\";\nmsg.payload = {\n \"id\": \"455936c5.4dc638\",\n \"label\": \"Flow 2\",\n \"nodes\": nodes\n \n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "x": 700,
        "y": 160,
        "wires": [
            [
                "3b0517f8.feb278"
            ]
        ]
    },
    {
        "id": "f440c43a.944c78",
        "type": "debug",
        "z": "9755354.1a5d8c8",
        "name": "results",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "x": 750,
        "y": 240,
        "wires": []
    },
    {
        "id": "3b0517f8.feb278",
        "type": "http request",
        "z": "9755354.1a5d8c8",
        "name": "",
        "method": "use",
        "ret": "txt",
        "paytoqs": false,
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "authType": "",
        "x": 730,
        "y": 200,
        "wires": [
            [
                "f440c43a.944c78"
            ]
        ]
    },
    {
        "id": "f260eee7.3be6d",
        "type": "inject",
        "z": "455936c5.4dc638",
        "name": "demo3",
        "props": [
            {
                "p": "payload",
                "v": "",
                "vt": "date"
            },
            {
                "p": "topic",
                "v": "",
                "vt": "string"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": true,
        "onceDelay": "1",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 130,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "641019e5.1d2ad8",
        "type": "persist in",
        "z": "455936c5.4dc638",
        "name": "demo",
        "storageNode": "7d21e8fc.4809e8",
        "x": 140,
        "y": 140,
        "wires": []
    }
]

```

now my issus I cant Load config or change it

 ![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/1/f1efe9206cba5e3e6cc5eed7ddd82ab6a06b6401.png)

so id for configs node its stored in storageNode

```auto
storageNode: "7d21e8fc.4809e8"

```

 ![Untitled](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/e/9/e984c4be672518c4f73bcf8613099a08affaa60e.png)  
so I see 3 types Flows, Subflows, Global Configuration Nodes and config not found in flows but Global Configuration Nodes  
so in this link you can load and set same keys into config via API method :

[https://nodered.org/docs/api/context/methods/](https://nodered.org/docs/api/context/methods/)

now how to used to GET config node and change it with API method !??  
Ity with

`ContextStore.get(persist-store, filename)`  
but error

```auto
"ReferenceError: ContextStore is not defined (line 1, col 15)"

```

---

_[View the full topic](https://discourse.nodered.org/t/edit-nodes-by-api-methods-help-me/42474)._
