[SOLVED] Contact Items, how to use OPEN/CLOSE and how to do status change through an API

I’ve a number of Raspberry devices in my house controlling some motion and door sensors (all via GPIO) and i’ve some python scripts running on them to report the status into a central smarthome controller.
I’m investigating if I can move to OpenHAB as a central controller. I want to create multiple “items” for the door and motion sensors. For motion I’m using a Switch, I expect that for the door sensor in need (can) use the Contact item, like:

Contact 	FrontDoorSensor    			"Voordeur:%s"				icon="door"			(HallWayGroundFloor, DoorSensors)

But how can I make update thew OPEN and CLOSED status through an API (URL)? Any suggestions?

Use the REST api:

Thanks, I found that indeed, I was able to update the switches but not the contacts. But in the mean time found out that I need to use the PUT HTTP command and NOT the POST. That did the trick.

Please mark the thread as solved. Thanks

Is that by putting [SOLVED] at the beginning of the subject?

No, it’s ticking the post with the solution:

The key thing is POST corresponds with sendCommand and PUT corresponds with sendUpdate and you cannot sendCommand OPEN/CLOSED.