Hi all,
As a new user I started using automate to build a flow to switch on automatically some lights in my home when I arrive after dark at my home.
The lights are switched on by using a HTTP POST request block using the following variable and input and output arguments:
Variable(s):
authorb64 = base64Encode("stretch:password", "")
Using the HTTP request block with settings
Request URL:
http://192.168.10.105/core/appliances;id=switchid/relayRequest method: POST
Request content type: XML
Request content: "<relay>state>on</state></relay>"
basic authorization account: "stretch"
request headers: {"Host" as String":"192.168.10.105", "Connection":"Close", "Content-Type":"application/xml", "Authorization": "Basic " ++ authorb64}
certificate: Trust insecure certificates
redirect: empty
save response: to variable as text
output variables: status, response
gives errormessage in variable status: 500
I tried various options, but to no avail. How can I solve this?
A call with the Windows WinHttp.WinHttpRequest object works fine using the following code:
PostAdres = Strcat("http://",StretchIP,"/core/appliances;id=",ApplianceID, "/relay")
PostGegevens = StrCat("<relay><state>",SwitchStatus,"</state></relay>")
oHTTP = ObjectCreate("WinHttp.WinHttpRequest.5.1")
oHTTP.Open("POST", PostAdres, @False)
oHTTP.SetRequestHeader("Host", StretchIP)
oHTTP.SetRequestHeader("Connection", "Close")
oHTTP.SetRequestHeader("Content-Type", "application/xml")
oHTTP.SetRequestHeader("Authorization", StrCat("Basic ", AuthorBase64))
oHTTP.Send(PostGegevens)
PostResponse = oHTTP.ResponseText
Any suggestions?
thanks for your help.
With regards, Jan Willem Teunisse