shelly-homekit icon indicating copy to clipboard operation
shelly-homekit copied to clipboard

API - HTTP Get Request No Password possible

Open Spy-1 opened this issue 2 years ago • 16 comments

Can someone please give me assistance with an http request? The following request works: 192.132.198.112/rpc/Shelly.SetState?id=1&type=0&state={%22state%22%3atrue}

However, if a password is set in the interface of the device, I can't get the request to work.

How and where do I set the password?

Spy-1 avatar Nov 17 '22 06:11 Spy-1

Does no one have any help for me ???

According to the description you should put a -user "admin:" -digest in front. Unfortunately this does not work!

An example request, also in the wiki, would be extremely helpful!

Spy-1 avatar Nov 18 '22 06:11 Spy-1

This issue is stale because it has been open 30 days with no activity. Comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 19 '22 02:12 github-actions[bot]

Is there a chance for fixing this?1

Spy-1 avatar Dec 19 '22 06:12 Spy-1

Can you provide an error message? Are you using curl?

markirb avatar Dec 22 '22 19:12 markirb

Sorry, no error Message! Pure HTTP request via Browser works without password

Spy-1 avatar Dec 22 '22 21:12 Spy-1

Again: are you using curl?

markirb avatar Dec 22 '22 21:12 markirb

The command is only valid for curl.

I do have the impression you're trying this via browser. The escaped url speeks that.

There's nothing to fix here....

https://en.wikipedia.org/wiki/CURL

markirb avatar Dec 22 '22 21:12 markirb

No, i don´t use curl. I am trying to control a shelly via an http-request. This works fine without a password and user set in the interface Once a user and password is entered in the interface this does not work anymore. 192.168.178.120/rpc/Shelly.SetState?id=1&type=0&state={"state":false} ist working well.

What ist the right request with setting a user and Password in shellys Userinterface?

Spy-1 avatar Dec 23 '22 14:12 Spy-1

Your request url is correct. You have to get the authentication right, therefore you have to send the right http headers as defined in https://en.wikipedia.org/wiki/Basic_access_authentication

How to do this is dependant on you browser, i saw there might be some plugins. The example you mentioned is for curl. I have not done this but should be doable.

Again, there is nothing to fix here...

markirb avatar Dec 23 '22 21:12 markirb

Again, this works in every browser! How to set this string witht admin and password to get him work! Where do i have to place this : --digest -u admin:1234

http://192.168.178.120/rpc/Shelly.SetState?id=1&type=0&state={"state":false} ist working well. --digest -u admin:1234 http://... does not if password is set in user interface

Spy-1 avatar Dec 24 '22 06:12 Spy-1

This works in every browser yes, the browser internally does https://en.wikipedia.org/wiki/Digest_access_authentication when calling the RPC backend via Javascript. It works that way, because for security reasons you do not send passwords via cleartext over a get request as that defeats most of the purpose of having a password in the first case (that's what you're basically asking).

What is your end use case of this? Maybe you can find a solution via cURL. You could also run reuse some of the Webpages Javascript and run that on your browser...

markirb avatar Dec 28 '22 09:12 markirb

I use a Lightmanager from jbMedia with which I can control different devices via radio, LAN or also e.g. Hue lights and other. The input mask for LAN controls looks like on the screenshot. Since I would like to secure my Shelly with a password, I can not use it in the configuration. Zwischenablagebild

Spy-1 avatar Dec 28 '22 18:12 Spy-1

@Spy-1 You can try http://admin:<your password>@<ip>/…

timoschilling avatar Dec 28 '22 19:12 timoschilling

and this is exactly this what doesn´t work!

Spy-1 avatar Dec 28 '22 22:12 Spy-1

and this is exactly this what doesn´t work!

I can agree. It also doesn't work on my side

albundy0815 avatar Feb 07 '23 04:02 albundy0815

This is not a bug. It is not supported currently and thus a feature request

markirb avatar Feb 09 '23 19:02 markirb