08.08.2023, 11:35
Try this:
Code:
json = require('json')
http = require('socket.http')
body = json.encode({
power_on = true
})
resp, code, hdrs, stat = http.request({
url = 'http://{IP address}/api/v1/state',
method = 'PUT',
headers = {
['Content-Type'] = 'application/json',
['Content-Length'] = #body,
},
body = body
})
log(resp, code, hdrs, stat)