16.03.2023, 03:05
http = require("socket.http")
ltn12 = require 'ltn12'
json = require('json')
http = require('socket.http')
url = 'http://192.168.0.xxx/v2/devices/--Devide ID--/actions/Close'
body = json.encode({
Close = {
{
argument = 'null',
}
}
})
resp_Values = {}
res, code, headers = http.request({
url = url,
method = 'PUT',
sink = ltn12.sink.table(resp_Values),
source = ltn12.source.string(body),
headers = {
['BOND-Token'] = 'b084cc33192220e',
['content-length'] = #body,
["Content-Type"] = "application/json";
}
})
Code above works for the Bond Bridge for anyone interested.
ltn12 = require 'ltn12'
json = require('json')
http = require('socket.http')
url = 'http://192.168.0.xxx/v2/devices/--Devide ID--/actions/Close'
body = json.encode({
Close = {
{
argument = 'null',
}
}
})
resp_Values = {}
res, code, headers = http.request({
url = url,
method = 'PUT',
sink = ltn12.sink.table(resp_Values),
source = ltn12.source.string(body),
headers = {
['BOND-Token'] = 'b084cc33192220e',
['content-length'] = #body,
["Content-Type"] = "application/json";
}
})
Code above works for the Bond Bridge for anyone interested.