Http://localhost:1880/serialports

Hello team,

http://localhost:1880/serialports used to return the list of serial ports for the server. But it seems changed and returns 'Unauthorized' when called. I know it works on the editor page, but I need to call this API from a UI page.

What is the things to have it return the list of ports?

Thanks.

When asking for help it is a good idea to provide information about your setup like

  1. what device and OS are you running NR on?
  2. what version of NR and node.js are you using? (you can get this from the node-red startup log)
  3. are you using Docker or Home Assistant?
  4. what browser are you using?
  5. what user ID is used to run the command?

When I run that on my Mac, I get a reply in Safari, Firefox, Chrome and Brave
["/dev/tty.debug-console","/dev/tty.wlan-debug","/dev/tty.usbmodem1234561","/dev/tty.Bluetooth-Incoming-Port"]

The serialports endpoint is an internal admin endpoint provided by the serial node.

So, you have to have the serialport node available on the palette.

But it is an ADMIN endpoint and secured with the same settings as you Editor web page.

It would be a serious security issue generally to make that list avail to the USER space rather than the ADMIN space.

But as long as you are aware of that issue. If you still want the list, you should probably create a small plugin or custom node to bridge the data. Alternatively, use an exec node to get the data from the OS and make that available as an endpoint using http-in/http-response nodes.

Thank you for your reply.

I'll provide those information for the next query if any.
For now @TotallyInformation seems to point out the cause.

When I unset the security setting, it is back working again.

Thank you. What you pointed out is the cause.
And yes, I understand the possible security issue. But the current scenario I'm working on is a local engineering web console for the serially attached equipments, so they can stay with those possibility.

I think it's okay to close now.

Thank you @zenofmud and @TotallyInformation again.