Further to another (solved) discussion https://community.openhab.org/t/reset-an-item-label-in-rule/141091/18 I have taken my first travel down the road of openHAB 3’s API.
I’m trying to use the HTTP binding to read/set some openHAB regional settings, e.g. the language, from within mainUI.
To this end, I have created an Item
settingLanguage, which is linked to a channel within a Thing created for the http binding:
UID: http:url:httpThing label: httpThing thingTypeUID: http:url configuration: ignoreSSLErrors: true headers: - Authorization= Bearer eyJraWQiOm51bGwsImFsZyI6IlJTMjU2In0.eyJpc3MiOiJvcGVuaGFiIiwiYXVkIjoib3BlbmhhYiIsImV4cCI6MTY2OTIzMDk4MCEio7itKKjCw_5hzPFXKsTKNA baseURL: http://openhabian:8080/rest/services/org.openhab.i18n delay: 0 stateMethod: GET refresh: 30 commandMethod: PUT contentType: application/json timeout: 3000 bufferSize: 2048 channels: - id: language channelTypeUID: http:string label: Language description: "" configuration: stateExtension: config stateTransformation: JSONPATH:$.language
This sort of works (for some time). My problem is I do not know, which authorization parameters to set in the Thing configuration, in order to access (my own) openHAB server via the API. I fumbled around with the Authentication Mode (Basic, Preemptive Basic and Digest) as well as Username/Password combinations as per suggestions in other topics. However, none of that worked. I have taken the shortcut to put in the Authentication= Bearer header which you can see in the code(disguised) and which is sniffed directly from the Network traffic. This works for a while, but then apparently this needs to be changed to another Header… so this isn’t a solution.
Can you point me in the direction of how to correctly set authentication and other headers for the HTTP binding in order to access my own openHAB server?