Bug fix openhab3 REST API: If the Accept types are not explicitly specified, the request fails with error code 400 or 401.
In OpenHab3 http basic auth authentication is disabled by default.
The basic auth authentication can be forced with Settings/API Security:
This also enables API token authentication in case a token was created.
Unfortunately, the REST API in openhab 3 returns an error code 400 or 401 if the HTTP-header field Accept is not set correctly for the supported return types, which are text/plain and application/json.
So the fix simply sets the header fields. This also enables API token authentication from within asterics.
Bug fix openhab3 REST API: If the Accept types are not explicitly specified, the request fails with error code 400 or 401.
In OpenHab3 http basic auth authentication is disabled by default.
The basic auth authentication can be forced with Settings/API Security:![grafik](https://user-images.githubusercontent.com/4621810/202461173-af19be56-e606-4918-b5d1-89532f9507d6.png)
This also enables API token authentication in case a token was created.
Unfortunately, the REST API in openhab 3 returns an error code 400 or 401 if the HTTP-header field
Accept
is not set correctly for the supported return types, which aretext/plain
andapplication/json
.So the fix simply sets the header fields. This also enables API token authentication from within asterics.