Hi,
I tried to access the openHAB 3 Rest API with curl and with a browser but it failed. Normally the syntax should be:
(https://username:password@URL)
If I go to MainUI → Settings → API Security the Implicit User Role is allowed. I also allowed the Basic Authentication.
As example I can use without user credentials http://<my_ip>:8080/rest/items
but I can not use http://<my_ip>:8080/rest/bindings
There I will receive:
error:
message: "Authentication required"
http-code: 401
My browser asks me about Confirmation: You are about to log in to the site "<my_ip>" with the username "<my_username>", but the website does not require authentication. The may be an attempt to trick you. Is "<my_ip>" the site you want to visit?
I answered with yes and I got Authentication required.
With curl I tried the -u
argument with username:password
and with username
and entered the password in the next line. So it’s not possible to access it.
I am amazed that I can access the items without username and password. But with username and password I can’t access Things or Bindings.
But I can access:
http://<my_ip>:8080/rest/
http://<my_ip>:8080/rest/uuid
http://<my_ip>:8080/rest/spec
http://<my_ip>:8080/rest/module-types
http://<my_ip>:8080/rest/iconsets
http://<my_ip>:8080/rest/audio
as example /sources
http://<my_ip>:8080/rest/voice
as example /interpreters
http://<my_ip>:8080/rest/habpanel
but not used
http://<my_ip>:8080/rest/templates
http://<my_ip>:8080/rest/events
as example /events?topics=openhab/thing
but will download an endless file.
http://<my_ip>:8080/rest/ui
but I don’t know what else.
http://<my_ip>:8080/rest/auth
as example but I don’t know what else.
http://<my_ip>:8080/rest/thing-types
http://<my_ip>:8080/rest/items
http://<my_ip>:8080/rest/profile-types
I can not access:
http://<my_ip>:8080/rest/persistence
http://<my_ip>:8080/rest/things
http://<my_ip>:8080/rest/bindings
http://<my_ip>:8080/rest/services
http://<my_ip>:8080/rest/discovery
http://<my_ip>:8080/rest/links
http://<my_ip>:8080/rest/config-descriptions
http://<my_ip>:8080/rest/systeminfo
http://<my_ip>:8080/rest/rules
http://<my_ip>:8080/rest/addons
http://<my_ip>:8080/rest/channel-types
http://<my_ip>:8080/rest/inbox
How can I use the REST API correctly and how to use the basic authentication correctly? Thanks in advance.