Open Platform
Skip to content

Upload lock battery ​

https://cnapi.ttlock.com/v3/lock/updateElectricQuantity

Upload the lock battery, which is get from APP SDK method, to server.

TTLock APP will upload lock battery to cloud when unlocking the lock by APP, you may follow this practices.

1 Request example ​

POST, ContentType:application/x-www-form-urlencoded

javascript
curl --location -g --request POST 'https://cnapi.ttlock.com/v3/lock/updateElectricQuantity' \
--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \
--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \
--data-urlencode 'lockId=163377' \
--data-urlencode 'electricQuantity=85' \
--data-urlencode 'date=1625025703000'

2 Request parameters ​

NameTypeRequiredDescription
clientIdStringYclient_id from Create application
accessTokenStringYAccess token,refer to: Get access token
lockIdIntYLock ID, generated by Lock init
electricQuantityIntYLock battery
dateLongYCurrent time (timestamp in millisecond)

3 Response and example ​

ParameterTypeDescription
errcodeIntError code
errmsgStringError message
{
    "errcode": 0, 
    "errmsg": "none error message"
}
CopyRight © 2012-2026 TTLock.All Rights Reserved