04.03.2022, 12:26
(03.03.2022, 09:04)admin Wrote: In this case you need to pass request source differently and also put username and password into the URL. Also don't forget to include digest library code before this.
Code:json = require('json')
url = 'https://username:password@exampleadr.com/pms_api/:subscription_id/:account_id/rooms/:room_id'
body = json.encode({
room = {
housekeeping_status = 'inspect'
}
})
resp = {}
res, code = request({
url = url,
method = 'PUT',
headers = {
['Content-Type'] = 'application/json',
['Content-Length'] = #body,
},
source = ltn12.source.string(body),
sink = ltn12.sink.table(resp),
})
print(res, code, resp)
Thank you so much for the help, worked perfectly!