REST API via Tasker - here: Permissions

Hi all,

I am invoking the REST API on my old Openhab 2 server from Tasker like this:

Works like a charm :slightly_smiling_face:

Doing the same on my new Openhab 3 server gives me error code “404” and:

However the following works from the Linux console both on the Openhab 3 server itself as well as from my Laptop:

curl -v -X POST --header "Content-Type: text/plain" --header "Accept: application/json" -d "ON" "http://{192.168.0.11}:8080/rest/items/RadiatorTimerSwitch"

Something is blocking the Tasker access…
Any idea?

I have added

org.eclipse.smarthome.cors:enable=true

into runtime.cfg as suggested in the documentation.

Cheers
Wolfgang

Since OH 3 doesn’t have any references to eclipse smarthome any more, I’m sure if that property still exists at all, it would be org.openhab.cors.

Do you have the implicit guest user enabled in the API security settings?

I have tried that, but no change.

I have in the meantime got access to the item via myopenhab.org.

Posting an ON or OFF to the item returns success code 200, but the item state does not change.

Got it working :slightly_smiling_face:

Did you get it working through tasker. Care to share how you did it?

Thanks

Yes via Tasker.

On your Openhab server expose the item(s) in the UI->Settings->Openhab Cloud

Create HTTP auth in Tasker:

Create Task with HTTP Auth as 1st action:

Create HTTP request as 2nd action:

1 Like

No, do not do that. The only reason to ever have done that is for IFTTT integration which has been turned off for years. Nothing else uses “exposed Items” at this time. Exposing the Items does not make them available to Tasker and on the flip side not exposing an Item does not hide that Item from Tasker.

Once authenticated, Tasker has access to everything.

Out of curiousity, are you aware that the openHAB Android app can serve as a Tasker plugin? You can’t monitor openHAB, but you can send commands from Tasker.

Yes I am aware of that, thanks.
But I wanted to test the REST API.

Cool. I just wanted to make sure. It’s easy to miss when features like this are added.

I opened an issue last year to update the “Items to expose” setting, but I’m not sure if it made it into 3.4 (I’m still on 3.3).

The PR was merged in July so it should be in 3.4.0+ but not in 3.3 and before.

I’m on 4.0 snapshot though and the option is still there in the UI. I wonder if that issue was erroneously closed?

I’m not very familiar with Github. It looks to me like it still needs Kai’s review? Might have gotten lost in the shuffle.

What’s the best way to draw attention to it politely? I don’t know what the etiquette is in Github.

No, purple means merged and closed but the PR that it’s claiming closed the issue doesn’t seem to be relevant.

I’d add a comment to the issue and ask if it was really meant to be closed because even as late as OH 4 it’s still showing the option in MainUI to select Items to expose.

Isn’t IFTTT still an option for users that spin up their own cloud servers? I assume the setting needs to remain available for those users.

Thank you for the update. Will have to combine this with Auto Notification.

Yep. I suggested hiding it in Advanced Settings and editing the description to say pretty much this.

Well, that’s true in the 3.4 release, so it looks like the PR did get correctly merged.

Oh, okay. So just not in 4.0. Weird.

I mistakenly had the show advanced checked. It’s indeed hidden.

1 Like

Well then, mystery solved. I look forward to seeing my meagre contribution to MainUI when I get around installing 3.4. :wink: