Skip to content

Getting Started

Registering OAuth clients

You can register OAuth clients with Tapkey using our self-service registration page.

OAuth clients are registered under an Owner Account in Tapkey's eco-system. After registration, an Owner Account will be created when registering your first locking device.

Don't have a locking device?

You can still create an Owner Account without registering a locking device. Click here to be redirected to Tapkey Web Portal and proceed logging in with your account. Next, click on the drop down menu in the navigation drawer and you should see a button "Create own locking system". Click there and you are good to go!

List locking devices

After registering a new OAuth client, listing a User's locking devices can be easily done using the Tapkey Management API. After obtaining an access token via OAuth, a User's Owner Accounts can be retrieved using the GET /owners operation.

var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", _accessToken);

var ownerAccountsTask = client.GetStringAsync("https://my.tapkey.com/api/v1/owners");
var json = await ownerAccountsTask;
var ownerAccounts = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(json);

After that, ownerAccount contains a list of Owner Accounts for the current User. If present, an Owner Account can be chosen from that list in order to query bound locks.

// For demo purposes, just take the first Owner Account…
var ownerAccountId = ownerAccounts.First()["id"];
// … and query for bound locks
var boundLocksTask = client.GetStringAsync(
    $"https://my.tapkey.com/api/v1/owners/{ownerAccountId}/boundlocks");
var json = await boundLocksTask;

var boundLocks = JsonConvert.DeserializeObject<List<Dictionary<string, object>>>(json);

At this point, boundLocks contains a list of bound locking devices for the selected Owner Account. Information about the respective locking devices is delivered as defined in the GET /owners/{ownerAccount}/boundlocks operation's response description below.

// Print a list of all bound locks
foreach (var boundLock in boundLocks)
{
    var lockInfo = new StringBuilder();
    lockInfo.AppendLine($"Lock ID: {boundLock["id"]}");
    lockInfo.AppendLine($"Title: {boundLock["title"]}");
    lockInfo.AppendLine($"Description: {boundLock["description"]}");
    lockInfo.AppendLine($"Lock is active: {boundLock["active"]}");
    lockInfo.AppendLine($"Binding date: {boundLock["bindDate"]}");
    Console.WriteLine(lockInfo);
}

Runnable Example Available

A complete, runnable console application that prints a list of locking devices can be found in the Tapkey Management API .NET samples repository on GitHub.