This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Bond Bridge API to LUA
#2
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.
Reply


Messages In This Thread
Bond Bridge API to LUA - by BrentW - 16.03.2023, 00:49
RE: Bond Bridge API to LUA - by BrentW - 16.03.2023, 03:05

Forum Jump: