2.2.1 • Published 4 years ago

nuki-web-api v2.2.1

Weekly downloads
142
License
MIT
Repository
github
Last release
4 years ago

Logo

nuki-web-api

Node.js implementation of the Nuki Web API

NPM version Downloads

NPM

Usage

let token = "YOUR TOKEN"
let nuki = new Nuki(token)

nuki.getAccount().then(function(res) {
	console.log('getAccount(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getAccount(): ' + e.message)});

nuki.getSmartlocks().then(function(res) {
	console.log('getSmartlocks(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlocks(): ' + e.message)});

nuki.getSmartlock(smartlockId).then(function(res) {
	console.log('getSmartlock(smartlockId): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlock(smartlockId): ' + e.message)});

nuki.getSmartlockAuths().then(function(res) {
	console.log('getSmartlockAuths(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockAuths(): ' + e.message)});

nuki.getSmartlockUsers().then(function(res) {
	console.log('getSmartlockUsers(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockUsers(): ' + e.message)});

nuki.getSmartlockAuth(smartlockId).then(function(res) {
	console.log('getSmartlockAuth(smartlockId): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockAuth(smartlockId): ' + e.message)});

nuki.getSmartlockAuth(smartlockId, userId).then(function(res) {
	console.log('getSmartlockAuth(smartlockId, userId): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartLockAuth(smartlockId, userId): ' + e.message)});

nuki.getSmartlockLogs().then(function(res) {
	console.log('getSmartlockLogs(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockLogs(): ' + e.message)});

nuki.getSmartlockLogs({limit: 3}).then(function(res) {
	console.log('getSmartlockLogs({limit: 3}): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockLogs({limit: 3}): ' + e.message)});

nuki.getSmartlockLogs(smartlockId).then(function(res) {
	console.log('getSmartlockLogs(smartlockId): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockLogs(smartlockId): ' + e.message)});

nuki.getSmartlockLogs(smartlockId, {limit: 3}).then(function(res) {
	console.log('getSmartlockLogs(smartlockId, {limit: 3}): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSmartlockLogs(smartlockId, {limit: 3}): ' + e.message)});

nuki.getSubscription().then(function(res) {
	console.log('getSubscription(): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSubscription(): ' + e.message)});

nuki.getSubscription(subscriptionId).then(function(res) {
	console.log('getSubscription(subscriptionId): ' + JSON.stringify(res))

}).catch(function(e) {console.error('getSubscription(subscriptionId): ' + e.message)});

Example

You may find a full implemented example at https://github.com/Zefau/ioBroker.nuki2.

API documentation (v1.2.0, 31.05.2019)

The source code documentation for this Node.js implementation of the Nuki Web API can be found at https://zefau.github.io/nuki-web-api/Nuki.html.

Subsequently a list of supported operations. See https://developer.nuki.io/page/nuki-web-api-120/3 for Nuki Web API documentation and https://api.nuki.io/ for the original list of operations.

You may use _req(paths[, parameters, method, body, options]) function for any of the following operations, e.g. _req('/account'). See API documentation for specific usage.

Account

Request TypePathActionImplemented
delete/accountDelete an accountnot implemented yet
get/accountGet an accountgetAccount() since 2.0.0
post/accountUpdate an accountnot implemented yet
put/accountCreate an accountnot implemented yet
delete/account/otpDisables one time password for an accountnot implemented yet
post/account/otpEnables one time password for an accountnot implemented yet
put/account/otpCreate an one time password secretnot implemented yet
post/account/password/resetReset account passwordnot implemented yet
get/account/subGet an list of sub accountsnot implemented yet
put/account/subCreate an sub accountnot implemented yet
delete/account/sub/{accountId}Delete an sub accountnot implemented yet
get/account/sub/{accountId}Get an sub accountnot implemented yet
post/account/sub/{accountId}Update an sub accountnot implemented yet

AccountSubscription

Request TypePathActionImplemented
post/account/subscription/payStarts a payment for an account and returns a payment urlnot implemented yet
post/account/subscription/{id}/activateActivates a previously terminated subscriptionnot implemented yet
post/account/subscription/{id}/terminateTerminates a running subscriptionnot implemented yet
get/app/account/subscriptionGet a list of account subscriptionsnot implemented yet

AccountUser

Request TypePathActionImplemented
get/account/userGet an list of account usersnot implemented yet
put/account/userCreate an account usernot implemented yet
delete/account/user/{accountUserId}Deletes asynchronous an account usernot implemented yet
get/account/user/{accountUserId}Get an account usernot implemented yet
post/account/user/{accountUserId}Update an account usernot implemented yet

Address

Request TypePathActionImplemented
get/addressGet a list of addressesnot implemented yet
post/address/{addressId}Update an addressnot implemented yet

AddressReservation

Request TypePathActionImplemented
get/address/{addressId}/reservationGet a list of address reservationsnot implemented yet
post/address/{addressId}/reservation/{id}/issueIssues authorizations for an address reservationnot implemented yet
post/address/{addressId}/reservation/{id}/revokeRevoke authorizations for an address reservationnot implemented yet

AddressToken

Request TypePathActionImplemented
get/address/token/{id}Gives some info about address tokennot implemented yet
get/address/token/{id}/redeemGives an redeemed address tokennot implemented yet
post/address/token/{id}/redeemRedeems an address tokennot implemented yet

ApiKey

Request TypePathActionImplemented
get/api/keyGet a list of api keysnot implemented yet
put/api/keyCreate an api keynot implemented yet
delete/api/key/{apiKeyId}Delete an api keynot implemented yet
post/api/key/{apiKeyId}Update an api keynot implemented yet
get/api/key/{apiKeyId}/tokenGet a list of api key tokensnot implemented yet
put/api/key/{apiKeyId}/tokenCreate an api key tokennot implemented yet
delete/api/key/{apiKeyId}/token/{id}Delete an api key tokennot implemented yet
post/api/key/{apiKeyId}/token/{id}Update an api key tokennot implemented yet

Company

Request TypePathActionImplemented
get/companyGet an list of companiesnot implemented yet

Notification (introduced in Nuki Web API v1.2.0)

Request TypePathActionImplemented
get/notificationGet all notifications attached to your accountgetNotification() since 2.1.0
put/notificationCreate a notification configurationnot implemented yet
delete/notification/{notificationId}Delete a notification configurationnot implemented yet
get/notification/{notificationId}Get a notification configurationgetNotification(notificationId) since 2.1.0
post/notification/{notificationId}Update a notification configurationnot implemented yet

OpenerIntercomBrand (introduced in Nuki Web API v1.2.0)

Request TypePathActionImplemented
get/opener/brandGet all intercom brandsgetBrand() since 2.1.0
get/opener/brand/{brandId}Get an intercom brandgetBrand(brandId) since 2.1.0

OpenerIntercomModel (introduced in Nuki Web API v1.2.0)

Request TypePathActionImplemented
get/opener/intercomGet a list of intercom modelsgetModel() since 2.1.0
get/opener/intercom/{intercomId}Get an intercom modelgetModel(intercomId) since 2.1.0

Service

Request TypePathActionImplemented
get/service/{serviceId}Get a servicenot implemented yet
post/service/{serviceId}/linkLinks a servicenot implemented yet
post/service/{serviceId}/syncSyncs a servicenot implemented yet
post/service/{serviceId}/unlinkUnlinks a servicenot implemented yet

Smartlock

Request TypePathActionImplemented
get/smartlockGet a list of smartlocksgetSmartLocks(parameters) since 2.0.0
put/smartlockCreate a smartlocknot implemented yet
delete/smartlock/{smartlockId}Delete a smartlocknot implemented yet
get/smartlock/{smartlockId}Get a smartlockgetSmartLock(smartlockId) since 2.0.0
post/smartlock/{smartlockId}Update a smartlockupdateSmartlock(smartlockId, update) since 2.0.0
post/smartlock/{smartlockId}/actionLock & unlock a smartlocksetAction(smartlockId, action) since 2.0.0
post/smartlock/{smartlockId}/admin/pinUpdates a smartlock admin pinnot implemented yet
post/smartlock/{smartlockId}/advanced/configUpdates a smartlock advanced configsetAdvancedConfig(smartlockId, configuration) since 2.2.0
post/smartlock/{smartlockId}/advanced/openerconfigUpdates an opener advanced configsetAdvancedConfig(smartlockId, configuration) since 2.2.0
post/smartlock/{smartlockId}/configUpdates a smartlock configsetConfig(smartlockId, configuration) since 2.2.0
post/smartlock/{smartlockId}/syncSyncs a smartlocknot implemented yet
post/smartlock/{smartlockId}/web/configUpdates a smartlock web confignot implemented yet

SmartlockAuth

Request TypePathActionImplemented
get/smartlock/authGet a list of smartlock authorizations for your smartlocksgetSmartLockAuths(parameters) since 2.0.0
put/smartlock/authCreates asynchronous smartlock authorizationsnot implemented yet
get/smartlock/{smartlockId}/authGet a list of smartlock authorizationsgetSmartLockAuth(smartlockId) since 2.0.0
put/smartlock/{smartlockId}/authCreates asynchronous a smartlock authorizationnot implemented yet
delete/smartlock/{smartlockId}/auth/{id}Deletes asynchronous a smartlock authorizationnot implemented yet
get/smartlock/{smartlockId}/auth/{id}Get a smartlock authorizationgetSmartLockAuth(smartlockId, userId) since 2.0.0
post/smartlock/{smartlockId}/auth/{id}Updates asynchronous a smartlock authorizationnot implemented yet

SmartlockLog

Request TypePathActionImplemented
get/smartlock/logGet a list of smartlock logs for all of your smartlocksgetSmartlockLogs(parameters) since 2.0.0
get/smartlock/{smartlockId}/logGet a list of smartlock logsgetSmartlockLogs(smartlockId, parameters) since 2.0.0

Subscription

Request TypePathActionImplemented
get/subscriptionGet a list of subscriptionsgetSubscription() since 2.0.0
get/subscription/{subscriptionId}Get a subscriptiongetSubscription(subscriptionId) since 2.0.0

Changelog

2.1.0 (2019-09-08)

  • (Zefau) added Opener support
  • (Zefau) added Notification support

2.0.1 (2019-03-22)

  • (Zefau) Node.js v6 compatibility

2.0.0 (2019-03-22)

API Documentation (using JSDoc)

You may update the API documentation using JSDoc (https://github.com/jsdoc3/jsdoc#installation-and-usage):

jsdoc lib -d docs --template ../minami

License

The MIT License (MIT)

Copyright (c) 2019 Zefau zefau@mailbox.org

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.