11.06.2024, 05:38
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)