POST http:/IP-address:port/device/di/0 

with content:

{"state": "closed"}

where

Example:

http://127.0.0.1:8080/device/di/0 
{"state": "closed"}