Why am I getting a 401 error on this REST command?

I have a REST command that sends instructions to Girder (an old automation program for Windows that’s the original backbone of my system). The commands get through and the actions are done. But still there’s this error in my Hass log every time, looking like this (the SECRET stuff is of course not what it says in the log):

Error. Url: http://SECRET_IP_ADDRESS:SECRET_PORT/SECRET_WEB_PAGE_NAME.html?1=Amplifier&2=1&3=8&4=SECRET_PASSWORD. Status code 401. Payload: None

I know that 401 is unauthorized, but why, when the command goes through?

Ask Girder :wink:

Did you try curl or a web browser to see if the behavior is the same outside of HA?

Thanks for answering! I could ask Girder, only it ended development ten years ago, and I have lost contact with the developer… But I found it! It worked with a regular browser, but the HTML was totally empty (by design, it only uses the html as an address to bind to, the rest of the command is read by Girder). Seems like REST didn’t like that, adding a few lines of code fixed it:

<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta http-equiv="PRAGMA" content="NO-CACHE">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="assets/style.css">
<title>Node-RED-commands</title>
</head>
<body>
</body>
</html>

Nope, spoke too soon. The error is back in. In a web browser there’s nothing, but in curl I get the same error:

<HTML><HEAD><TITLE>401 Unauthorized</TITLE></HEAD><BODY><H1>Unauthorized</H1><P>You are not authorized to access this URL

I have no idea why this happens, because the password is correct, and the command goes through. I guess I’ll just have to ignore it, I don’t see any way to stop it.

Finally found it. There was a password on the web page that I had forgotten… And the command went through without it since it is a GET command. Using the http://user:password@URL format finally fixed it! My bad.