Node-RED
Node-RED offers its locks. Creates or updates a smart lock connection (provider "nodered"); the locks become smart locks when an administrator syncs the devices of that connection.
POST/api/nodered/smart_lock/register
Expects JSON body:
{
"instance_id": "
Responses
200Registration resultobject
Show fields (5)
statusstringcreated, updated or restored
connection_idintegerlocksintegersmart_locksintegersmart locks the administrator already synced
mqttobjectdelivery mqtt: broker access of the bridge
Show fields (6)
urlstringusernamestringpasswordstringMQTT JWT, valid 30 days
client_idstringtopicstringvalid_untilstring
curl --request POST \
--url https://your-instance.iw-erp.de/api/nodered/smart_lock/register \
--header 'x-iw-jwt-token: <TOKEN>'const options = {method: 'POST', headers: {'x-iw-jwt-token': '<TOKEN>'}};
fetch('https://your-instance.iw-erp.de/api/nodered/smart_lock/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.iw-erp.de/api/nodered/smart_lock/register"
headers = {"x-iw-jwt-token": "<TOKEN>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-instance.iw-erp.de/api/nodered/smart_lock/register', [
'headers' => [
'x-iw-jwt-token' => '<TOKEN>',
],
]);
echo $response->getBody();using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://your-instance.iw-erp.de/api/nodered/smart_lock/register"),
Headers =
{
{ "x-iw-jwt-token", "<TOKEN>" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://your-instance.iw-erp.de/api/nodered/smart_lock/register")
.post(null)
.addHeader("x-iw-jwt-token", "<TOKEN>")
.build();
Response response = client.newCall(request).execute();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-instance.iw-erp.de/api/nodered/smart_lock/register"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-iw-jwt-token", "<TOKEN>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Dart with package:http (no controller in the iw_erp_api package)
import 'package:http/http.dart' as http;
final response = await http.post(
Uri.parse('https://your-instance.iw-erp.de/api/nodered/smart_lock/register'),
headers: {'x-iw-jwt-token': '<TOKEN>'},
);
print(response.body);{
"status": "string",
"connection_id": 42,
"locks": 1,
"smart_locks": 1,
"mqtt": {
"url": "https://vynst.de",
"username": "lena.hartmann@example.org",
"password": "••••••••",
"client_id": "42",
"topic": "string",
"valid_until": "string"
}
}Node-RED stops offering its locks. Expects JSON body {"instance_id": "...", "secret": "..."}.
DELETE/api/nodered/smart_lock/register
Responses
default
curl --request DELETE \
--url https://your-instance.iw-erp.de/api/nodered/smart_lock/register \
--header 'x-iw-jwt-token: <TOKEN>'const options = {method: 'DELETE', headers: {'x-iw-jwt-token': '<TOKEN>'}};
fetch('https://your-instance.iw-erp.de/api/nodered/smart_lock/register', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.iw-erp.de/api/nodered/smart_lock/register"
headers = {"x-iw-jwt-token": "<TOKEN>"}
response = requests.delete(url, headers=headers)
print(response.text)<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://your-instance.iw-erp.de/api/nodered/smart_lock/register', [
'headers' => [
'x-iw-jwt-token' => '<TOKEN>',
],
]);
echo $response->getBody();using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Delete,
RequestUri = new Uri("https://your-instance.iw-erp.de/api/nodered/smart_lock/register"),
Headers =
{
{ "x-iw-jwt-token", "<TOKEN>" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://your-instance.iw-erp.de/api/nodered/smart_lock/register")
.delete(null)
.addHeader("x-iw-jwt-token", "<TOKEN>")
.build();
Response response = client.newCall(request).execute();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-instance.iw-erp.de/api/nodered/smart_lock/register"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-iw-jwt-token", "<TOKEN>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Dart with package:http (no controller in the iw_erp_api package)
import 'package:http/http.dart' as http;
final response = await http.delete(
Uri.parse('https://your-instance.iw-erp.de/api/nodered/smart_lock/register'),
headers: {'x-iw-jwt-token': '<TOKEN>'},
);
print(response.body);Result of a command Node-RED got over MQTT. Expects JSON body {"instance_id": "...", "secret": "...", "success": true, "state": "unlocked", "message": "..."}.
POST/api/nodered/smart_lock/commands/{identifier}/result
Path parameters
identifierrequiredstring |
Responses
default
curl --request POST \
--url https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result \
--header 'x-iw-jwt-token: <TOKEN>'const options = {method: 'POST', headers: {'x-iw-jwt-token': '<TOKEN>'}};
fetch('https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result"
headers = {"x-iw-jwt-token": "<TOKEN>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result', [
'headers' => [
'x-iw-jwt-token' => '<TOKEN>',
],
]);
echo $response->getBody();using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result"),
Headers =
{
{ "x-iw-jwt-token", "<TOKEN>" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result")
.post(null)
.addHeader("x-iw-jwt-token", "<TOKEN>")
.build();
Response response = client.newCall(request).execute();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-iw-jwt-token", "<TOKEN>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Dart with package:http (no controller in the iw_erp_api package)
import 'package:http/http.dart' as http;
final response = await http.post(
Uri.parse('https://your-instance.iw-erp.de/api/nodered/smart_lock/commands/42/result'),
headers: {'x-iw-jwt-token': '<TOKEN>'},
);
print(response.body);May a credential a reader at Node-RED read (app QR code of the lock, member card QR, RFID card number) open the lock? Writes the smart lock log.
POST/api/nodered/smart_lock/check_access
Expects JSON body: { "instance_id": "...", "lock_id": "front_door", // a lock of this Node-RED instance "smart_lock_id": 12, // or any ERP smart lock "credential": "04A1B2C3D4", "credential_type": "auto", // auto, access_code, member_card or card "open": false // ERP opens a lock of another provider itself }
Responses
200Access decisionobject
Show fields (6)
grantedbooleanreasonstringgranted, unknown_credential, no_access, invalid_code or code_expired
credential_typestringsmart_lockobjectShow fields (2)
idintegernamestring
personobjectShow fields (2)
idintegernamestring
openedboolean
curl --request POST \
--url https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access \
--header 'x-iw-jwt-token: <TOKEN>'const options = {method: 'POST', headers: {'x-iw-jwt-token': '<TOKEN>'}};
fetch('https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access"
headers = {"x-iw-jwt-token": "<TOKEN>"}
response = requests.post(url, headers=headers)
print(response.text)<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access', [
'headers' => [
'x-iw-jwt-token' => '<TOKEN>',
],
]);
echo $response->getBody();using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Post,
RequestUri = new Uri("https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access"),
Headers =
{
{ "x-iw-jwt-token", "<TOKEN>" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access")
.post(null)
.addHeader("x-iw-jwt-token", "<TOKEN>")
.build();
Response response = client.newCall(request).execute();package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("x-iw-jwt-token", "<TOKEN>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}Dart with package:http (no controller in the iw_erp_api package)
import 'package:http/http.dart' as http;
final response = await http.post(
Uri.parse('https://your-instance.iw-erp.de/api/nodered/smart_lock/check_access'),
headers: {'x-iw-jwt-token': '<TOKEN>'},
);
print(response.body);{
"granted": true,
"reason": "string",
"credential_type": "string",
"smart_lock": {
"id": 42,
"name": "Beispiel"
},
"person": {
"id": 42,
"name": "Beispiel"
},
"opened": true
}