Get the open state of a lock
https://cnapi.ttlock.com/v3/lock/queryOpenState
Get the open state of a lock via gateway or WiFi lock. If the lock is also bound to a door sensor, this API also returns the door sensor status
1 Request example
javascript
curl --location --request GET 'https://cnapi.ttlock.com/v3/lock/queryOpenState?clientId=4773aa036f7f49c68d876bb4be85c80c&accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f&lockId=163377&date=1626674054000'2 Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| clientId | String | Y | client_id from Create application |
| accessToken | String | Y | Access token,refer to: Get access token |
| lockId | Int | Y | Lock ID, generated by Lock init |
| date | Long | Y | Current time (timestamp in millisecond) |
3 Response and example
| Parameter | Type | Description |
|---|---|---|
| state | Int | Open state of lock:0-locked,1-unlocked,2-unknown |
{
"state": 1
}