Unable to get current node-red flows using Admin API GET Method

Hi all,

I am running Node-Red 2.0.6 on a Raspberry Pi 4 and want to get all the currently deployed flows as a JSON object using the HTTP Admin API GET Method.

For this, I used an http request node and selected GET method. In the URL section, I put http://localhost/flows and specified the login credentials by clicking on the checkbox for authentication.

After deploying a simple flow (shown in the image), I am getting an output msg object which says -

GET

Debug node log :

1/3/2022, 2:42:21 PMnode: a41e36319a7a5959msg : string[16]
"JSON parse error"
payload: string

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot GET /flows</pre>
</body>
</html>

topic: ""
statusCode: 404
headers: object
x-powered-by: "Express"
content-security-policy: "default-src 'none'"
x-content-type-options: "nosniff"
content-type: "text/html; charset=utf-8"
content-length: "144"
vary: "Accept-Encoding"
date: "Mon, 03 Jan 2022 13:42:21 GMT"
connection: "close"
x-node-red-request-node: "5726158e"
responseUrl: "http://rds-00.pc.cognex.com/flows"
redirectList: array[0]
retry: 0

It is clear to me as per the documentation that statusCode:404 means that the resource was not found but I am confused about the reason.

I might probably be making a rookie mistake in terms of using the GET method but so far, I have not found anything to support this argument.

Any help/suggestions are welcome.

[Json for flow]

[{"id":"05569bcb5a515175","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"a41e36319a7a5959","type":"http request","z":"05569bcb5a515175","name":"","method":"GET","ret":"obj","paytoqs":"body","url":"http://localhost/flows","tls":"","persist":false,"proxy":"","authType":"basic","x":550,"y":420,"wires":[["2b13c2a959d26922"]]},{"id":"50675d657a6f5987","type":"http request","z":"05569bcb5a515175","d":true,"name":"","method":"POST","ret":"obj","paytoqs":"ignore","url":"","tls":"","persist":false,"proxy":"","authType":"","x":1030,"y":60,"wires":[[]]},{"id":"1b5f02b2dd797071","type":"inject","z":"05569bcb5a515175","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":340,"y":420,"wires":[["a41e36319a7a5959"]]},{"id":"2b13c2a959d26922","type":"debug","z":"05569bcb5a515175","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":730,"y":420,"wires":[]}]

By default, Node-RED listens on port 1880, so the expected URL would be http://localhost:1880/flows

Thanks for the comment @knolleary . However, I have chosen to run node-red on Port:80 and specifying it in the URL is still not helping.

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