Virtual Locks

The Integrator API allows for the creation of Virtual Locks, these are Locks that are not linked to a physical device but behave like one: they can receive open and close commands via the Unloc app.

A Virtual Lock is meant to be used for testing your implementation while developing. You will find them useful when you haven't decided on a Lock Vendor yet but want to start implementing a solution, or you don't have a physical Lock with you to test out, or simply when you need to have a specific amount of Locks available on your Lock Holder — when you want to test a pagination feature, for instance.

A Virtual Lock is always associated with a Vendor of type virtual, which can hold up to 100 Locks.

Creating a Virtual Lock

1. Create a Lock Holder

If you don't already have a Lock Holder, create one. A Lock Holder can include Locks from several different Vendor Connections, this includes the Vendor virtual.

2. Create a Connection to a virtual Vendor

Create a new Vendor Connection specifying only the vendor property and setting it to virtual and the locksToCreate property defining amount of Virtual Locks you want to create (up to 100 per Vendor Connection to a virtual Vendor).

3. Get the Virtual Lock IDs

After creating the Virtual Vendor, the Get all Locks from a Lock Holder endpoint will return the Virtual Locks you just created within its regular locks array. You can quickly identify them by their name — Virtual Lock *some ID* — and vendor. Here's an example:

{
    "locks": [
        {
            "id": "c0f3aed0-2a7e-4de5-a0ff-3bfc22bfb6ef",
            "name": "Virtual Lock 475",
            "vendor": "virtual",
            "auth": {},
            "created": "2021-12-08T19:41:14.108Z",
            "duplicateLock": false,
            "canCreateKeysCount": 0,
            "keysCreatedCount": 0
        },
        {
            "id": "c1734ed2-8d54-486d-928d-cc108be7cc58",
            "name": "Virtual Lock ec7",
            "vendor": "virtual",
            "auth": {},
            "created": "2021-12-08T19:41:14.402Z",
            "duplicateLock": false,
            "canCreateKeysCount": 0,
            "keysCreatedCount": 0
        }
  ]
}

As mentioned before, you can start using them right away during your development process and create as many as you may require.

📘

Keep in mind that as of today the API does not include an endpoint to delete Virtual Locks or Lock Holders.


Did this page help you?