Admin API problem with PUT - solved

Hello, I have a problem using the PUT method in the admin API

I created the following simple flow tab without any problems using POST method:

{"id":"1234","label":"Sheet1","nodes":[],"configs":[],"subflows":[]}

If I use the GET method on the id it responded with it responds with:

{"id":"0f2aa1caef0ffc51","label":"Sheet1","nodes":[]}

Now I would like just to change the label of the tab flow using the PUT method but it fails

{"id":"0f2aa1caef0ffc51","label":"Sheet2","nodes":[]}

I cannot figure out where I go wrong, any hints? Sample flow below
(using NR 4.0.5)

[
    {
        "id": "a9a79ff2fc54e172",
        "type": "http request",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "method": "POST",
        "ret": "txt",
        "paytoqs": "query",
        "url": "http://localhost:1880/flow",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 400,
        "y": 860,
        "wires": [
            [
                "4967cebcccfb184b"
            ]
        ]
    },
    {
        "id": "c82a1f7bbb1c3434",
        "type": "change",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "url",
                "pt": "msg",
                "to": "\"http://localhost:1880/flow/\" & payload",
                "tot": "jsonata"
            },
            {
                "t": "delete",
                "p": "payload",
                "pt": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 960,
        "wires": [
            [
                "7248bf88861a8d69"
            ]
        ]
    },
    {
        "id": "4967cebcccfb184b",
        "type": "debug",
        "z": "76de0c6b9b65f93e",
        "name": "debug 379",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 860,
        "wires": []
    },
    {
        "id": "7248bf88861a8d69",
        "type": "http request",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "method": "GET",
        "ret": "txt",
        "paytoqs": "ignore",
        "url": "",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 610,
        "y": 960,
        "wires": [
            [
                "a585cebd104d5e28"
            ]
        ]
    },
    {
        "id": "b36410c3ea9b7c50",
        "type": "comment",
        "z": "76de0c6b9b65f93e",
        "name": "request to add a new flow tab",
        "info": "",
        "x": 220,
        "y": 820,
        "wires": []
    },
    {
        "id": "5e26c559bebd2a8c",
        "type": "comment",
        "z": "76de0c6b9b65f93e",
        "name": "request to retrieve a flow tab",
        "info": "",
        "x": 220,
        "y": 920,
        "wires": []
    },
    {
        "id": "056c13cdd60e50f2",
        "type": "http request",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "method": "PUT",
        "ret": "txt",
        "paytoqs": "query",
        "url": "http://localhost:1880/flow",
        "tls": "",
        "persist": false,
        "proxy": "",
        "insecureHTTPParser": false,
        "authType": "",
        "senderr": false,
        "headers": [],
        "x": 400,
        "y": 1060,
        "wires": [
            [
                "170c52e615582814"
            ]
        ]
    },
    {
        "id": "170c52e615582814",
        "type": "debug",
        "z": "76de0c6b9b65f93e",
        "name": "debug 380",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 610,
        "y": 1060,
        "wires": []
    },
    {
        "id": "28653f93786fb06c",
        "type": "comment",
        "z": "76de0c6b9b65f93e",
        "name": "request to update an existing flow tab",
        "info": "",
        "x": 250,
        "y": 1020,
        "wires": []
    },
    {
        "id": "51399a72f866f581",
        "type": "inject",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"id\":\"0f2aa1caef0ffc51\",\"label\":\"Sheet2\",\"nodes\":[]}",
        "payloadType": "jsonata",
        "x": 150,
        "y": 1060,
        "wires": [
            [
                "056c13cdd60e50f2"
            ]
        ]
    },
    {
        "id": "2c18f5b59bdea89e",
        "type": "inject",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "{\"id\":\"1234\",\"label\":\"Sheet1\",\"nodes\":[],\"configs\":[],\"subflows\":[]}",
        "payloadType": "json",
        "x": 150,
        "y": 860,
        "wires": [
            [
                "a9a79ff2fc54e172"
            ]
        ]
    },
    {
        "id": "4c9363a6a59fce6d",
        "type": "inject",
        "z": "76de0c6b9b65f93e",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0f2aa1caef0ffc51",
        "payloadType": "str",
        "x": 180,
        "y": 960,
        "wires": [
            [
                "c82a1f7bbb1c3434"
            ]
        ]
    },
    {
        "id": "a585cebd104d5e28",
        "type": "debug",
        "z": "76de0c6b9b65f93e",
        "name": "debug 382",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 810,
        "y": 960,
        "wires": []
    }
]

Because the id is missing in the PUT request: http://localhost:1880/flow/[nodeId]

So with your example the correct URL is http://localhost:1880/flow/0f2aa1caef0ffc51

1 Like

Thank you so much!!

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