Hi all,
I finally got my Sesame WIFI dongle(it took like 3 years!!!) and I would now like to integrate it into OpenHab

They do have a REST-API:

But how can I make a switch in Openhab to lock/unlock the Sesame lock?

I guess I need to store the authenication token in a string item and run a cron rules every 29 days or so and on system startup to receive a new authenicationToken? (It expires every 30 days, according to the manual)

I guess it would be something like this:

val autencatationToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxx" <- how to obtain a valid one?
val httpRequest = ""
SesameLock.sendCommand( sendHttpGetRequest(httpRequest) mappings=["ON"="200", "OFF"="204"])

Or is it better to use the exec binding?

curl -H "X-Authorization: autencatationToken" \
    -H "Content-Type: application/json" \
    -X POST -d '{"type":"lock"}' \

I have never used rest-api so I am struggling on how to handle it well.

The beginning of that tutorial you linked to shows how to get the authentication token.

It might be easier if they provide curl examples. Then it is just copy and paste. I’m not sure what they are showing though. It looks like they are showing you how to use it using Postman which doesn’t really help much.

But it also says it expire every 30 days, so how does people normally get around this? Ask for a new token every time the switch is pressed, cron rules, or is there a better way?

Well, their REST API isn’t very standard. The standard way to do this is oauth2. When you are using oauth2 when your auth token expires you will get a 401 return code.

Searching around that doc it appears that they are at least doing that much. So the approach would be to make the call, if it returns a 401 instead of 200 return code you know the token is invalid and you need to go get a new one. You can see a similar example using oauth2 at OAuth2 using just OH Rules and