http post request issues - 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 post request issues (/showthread.php?tid=4820) |
http post request issues - stork - 09.06.2023 I'm trying to send energy data through an API by using http.request: Code: local dateTime=os.date("%Y-%m-%dT%H:%M") log(res,code,headers, status) returns: * arg: 1 * nil * arg: 2 * string: Try again * arg: 3 * nil * arg: 4 * nil response_body is empty. Headers are as specified by the API-provider. Any ideas what might be wrong? Hiow should I understand the "Try again" from log(code)? RE: http post request issues - admin - 09.06.2023 Check that gateway and DNS settings are valid in System config > Network > Interfaces > eth0. RE: http post request issues - stork - 09.06.2023 They should be. The LM5 is online. RE: http post request issues - Erwin van der Zwart - 09.06.2023 I think your body is not a valid json format, you are missing a " in the values property RE: http post request issues - stork - 09.06.2023 Thanks for the replies. You are right, I saw that one, but had to add another DNS to be able to communicate. Also I had to add content-length even if it was not specified by the API-provider. Thanks for notifying me about DNS-settings, which was part of the problem. |