Update
Update lock.
PATCH https://api.tedee.com/api/v1.33/my/lock
Body Parameters
Name |
Type |
Description |
---|---|---|
id |
number |
id of lock |
revision |
number |
current lock information and settings in database |
deviceSettings |
Device settings (optional) |
device settings to be updated |
name |
string (optional) |
lock name |
userSettings |
Lock user settings (optional) |
settings of current user for that device |
timeZone |
datetime (optional) |
timezone of lock |
All parameters in this endpoint (except id and revision) are optional. This means that specifying a given parameter will update its value. If a given parameter is not specified, its value will not change.
Only the owner or admin can update device settings and name. Guest can only modify lock user settings.
Responses
Name |
Type |
Description |
---|---|---|
200 OK |
successful operation |
|
409 Conflict |
revision in request is different than in database |
Scopes
Name |
Description |
---|---|
Device.ReadWrite |
Grants user possibility to read and write data connected with devices |
Examples
To better understand the idea of updating lock we prepared following examples:
Update name of the lock
Example shows how to update name of the lock with id = 1. Only owner or admin can update name of the device.
Sample Request
curl -X PATCH "https://api.tedee.com/api/v1.33/my/lock" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer <<access token>>" -d "<<body>>"
Body:
{
"id": 1,
"revision": 1,
"name": "New Name"
}
Sample response
HTTP status code: 200
{
"result": {
"id": 1,
"revision": 2,
"targetDeviceRevision": 1
}
"success": true,
"errorMessages": [],
"statusCode": 200
}
Update single device setting
Example shows how to update single device setting (as presented below it is auto lock delay) of the lock with id = 1. Only owner or admin can update name of the device.
Sample Request
curl -X PATCH "https://api.tedee.com/api/v1.33/my/lock" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer <<access token>>" -d "<<body>>"
Body:
{
"id": 1,
"revision": 1,
"deviceSettings": {
"autoLockDelay": 10
}
}
Sample response
HTTP status code: 200
{
"result": {
"id": 1,
"revision": 2,
"targetDeviceRevision": 2
}
"success": true,
"errorMessages": [],
"statusCode": 200
}
Note
Take a look at response of that request. TargetDeviceRevision changed as well as revision. It is because changing any device setting will change actual settings on the device.
Update single user setting
Example shows how to update single user setting (as presented below it is auto unlock) of the lock with id = 1. This action can be performed by any user with active share to that device.
Sample Request
curl -X PATCH "https://api.tedee.com/api/v1.33/my/lock" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer <<access token>>" -d "<<body>>"
Body:
{
"id": 1,
"revision": 1,
"userSettings":{
"autoUnlockEnabled": true
}
}
Sample response
HTTP status code: 200
{
"result": {
"id": 1,
"revision": 2,
"targetDeviceRevision": 1
}
"success": true,
"errorMessages": [],
"statusCode": 200
}
Update location for auto unlock feature
Example shows how to change location of the lock with id = 1. This action can be performed by any user with active share to that device.
Note
Changing location has sense only if user has enabled auto unlock feature.
Sample Request
curl -X PATCH "https://api.tedee.com/api/v1.33/my/lock" -H "accept: application/json" -H "Content-Type: application/json-patch+json" -H "Authorization: Bearer <<access token>>" -d "<<body>>"
Body:
{
"id": 1,
"revision": 1,
"userSettings": {
"location": {
"latitude": 52.24070739746092,
"longitude": 21.086990356445305
}
}
}
Sample response
HTTP status code: 200
{
"result": {
"id": 1,
"revision": 2,
"targetDeviceRevision": 1
}
"success": true,
"errorMessages": [],
"statusCode": 200
}