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.

openDTU - JSON - http post - "no values found"
#4
Try this:
Code:
json = require('json')
ltn12 = require('ltn12')
http = require('socket.http')
url = require('socket.url')

body = json.encode({
  limit_value = '10',
  limit_type = '1',
  serial = '000000000000'
})

body = 'data=' .. url.escape(body)

resp, code, hdrs, stat = http.request({
  url = 'https://192.168.1.000/api/limit/config',
  method = 'POST',
  headers = {
    ['Authorization'] = 'Basic '..(mime.b64('admin:password')),
    ['Content-Length'] = #body,
  },
  source = ltn12.source.string(body),
})

log(resp, code, hdrs, stat)
Reply


Messages In This Thread
RE: openDTU - JSON - http post - "no values found" - by admin - 11.06.2024, 05:38

Forum Jump: