10.06.2024, 06:52
Try this:
Code:
json = require('json')
ltn12 = require('ltn12')
http = require('socket.http')
body = json.encode({
limit_value = '10',
limit_type = '1',
serial = '000000000000'
})
resp, code, hdrs, stat = http.request({
url = 'http://192.168.1.000/api/limit/config',
method = 'POST',
headers = {
['Authorization'] = 'Basic '..(mime.b64('admin:password')),
['Content-Type'] = 'application/json',
['Content-Length'] = #body,
},
source = ltn12.source.string(body),
})
log(resp, code, hdrs, stat)