Logic Machine Forum
http.request & body - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: http.request & body (/showthread.php?tid=2698)



http.request & body - SigmaTec - 25.06.2020

Hi all,

is ther any way to add a "body" string as parameter of the http.request, as it's possible to do it with "header" ?

Many thank's in advance for your help.

All the best from France


RE: http.request & body - admin - 25.06.2020

Second parameter for the request function is body when using simple form: http.request(url, body)


RE: http.request & body - SigmaTec - 25.06.2020

I thnik I'm not using a simple form...
I have to integrate as body '{"time":"2020-06-09 16:27:36"}' for a REST process, in the following lines.


local res, err = http.request({
url = url,
method = 'POST',
-- protocol = 'tlsv12' -- only for old LM firmware
headers = headers,
sink = ltn12.sink.table(resp),
source = ltn12.source.string(data)
})


RE: http.request & body - admin - 25.06.2020

See this: https://forum.logicmachine.net/showthread.php?tid=1786&pid=17034#pid17034


RE: http.request & body - SigmaTec - 25.06.2020

Ok Admin,

I founded the "source" parameter to pass my REST/Json command body.
Know it works fine !

Thank's and have a good end of week.