03.12.2021, 16:09
With 2021 firmware you can do it like this. Passing body as a table will automatically encode it as needed and will set request method to POST.
Code:
res, err = socket.http.request({
url = 'http://127.0.0.1/scada-main/trends/save',
user = 'admin',
password = 'admin_p@ssword',
body = {
data = json.encode(trend)
}
})