Locks
Get all Locks from a Lock Holder
When it's time to query for the Locks of a Lock Holder, you only have to make a single GET request to:
https://api.unloc.app/integrators/v1/lock-holders/{{your_lock_holder_id}}/locks/
Example:
curl --location --request GET '<<api_url>>/integrators/v1/lock-holders/866b8a35-4184-44c5-8ffd-448a77e5a91c/locks/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer mV4cI6MTY1NDAzMjI3N3IiXX0m2hU91eGGWP.muTmF5eUiOiJSb2N0c0bkwVwnwcetb' \
The response will contain a list of all the locks associated with that Lock Holder ID:
{
"locks": [
{
"id": "ba193242-3cb2-4ac7-beef-d41668a009bb",
"name": "My front door",
"vendor": "Danalock",
"imageUrl": "https://www.example.com/image1.jpg",
"auth": {
"Bubbas cleaning company": "opt-in",
"Bubbas 'make a mess' company": "deny",
},
"address": {
"street": "336 East 6th street",
"postalCode": 10013,
"city": "New York",
"countryIso": "us",
"floor": "2. floor",
"visitorInstructions": "The door is red",
},
"canCreateKeysCount": 2,
"keysCreatedCount": 4
},
//...
]
}
Get a single Lock
If you want to query for a specific Lock inside the same Lock Holder, we got you covered! Just make a GET request to:
https://api.unloc.app/integrators/v1/lock-holders/{{your_lock_holder_id}}/locks/{{your_lock_id}}/
Example:
curl --location --request GET '<<api_url>>/integrators/v1/lock-holders/866b8a35-4184-44c5-8ffd-448a77e5a91c/locks/af58f1b9-dc21-4fc6-9828-2f2d51e75ff3/' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer mV4cI6MTY1NDAzMjI3N3IiXX0m2hU91eGGWP.muTmF5eUiOiJSb2N0c0bkwVwnwcetb' \
The response you get contains the same Lock data as in the response you get when querying for all the Locks from a Lock Holder:
{
"lock": {
"id": "ba193242-3cb2-4ac7-beef-d41668a009bb",
"name": "My front door",
"vendor": "Danalock",
"imageUrl": "https://www.example.com/image1.jpg",
"auth": {
"Bubbas cleaning company": "opt-in",
"Bubbas 'make a mess' company": "deny",
},
"address": {
"street": "336 East 6th street",
"postalCode": 10013,
"city": "New York",
"countryIso": "us",
"floor": "2. floor",
"visitorInstructions": "The door is red",
},
"canCreateKeysCount": 2,
"keysCreatedCount": 4
}
}
Updated over 1 year ago
Now that you have a better understanding of the Locks API endpoints, it's a good idea to move onto the Keys section