Beginners help with HTTP request


#1

1) Give a description of the problem
I am trying to send an HTTP request to a local webserver. The local IP is 192.168.1.18

When I manuall enter in a browser http://192.168.1.18/PIN it will react with “PIN request received”

I am now trying out several methods to do this from within a webCORE piston but get no results. I am new to HTTP request so please bare with me.

2) What is the expected behavior?
response from the server in it’s debug window or even better in a variable in webCORE

3) What is happening/not happening?
web server does not seem to receive the message

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
(PASTE YOUR LOGS HERE BETWEEN THE MARKS)

REMOVE BELOW AFTER READING
If a solution is found for your question then please mark the post as the solution.


#2

What happens if you enter the whole http://192.168.1.18/PIN in the URL and make it a GET request (JSON type and leave send variables blank)


#3

Can’t you do it as a Web Request and type in http://192.168.1.18/PIN. I am not sure what a HEAD request is.


#4

Thanks for the suggestion ! Indeed with the whole string it does work ! Probably not the right way but hey … it does the job !

:slight_smile:


#5

Are HTTP requests from webcore local to your home network? Does the request come from the St servers down to your hub and then your hub broadcast out that request to the IP on your network?


#6

Yes


#7

@ipaterson can correct me here, but when I do POST requests from webcore, because the request comes from the ST servers, I had to use my public IP and not my LAN IP.


#8

Nope, local requests support all of the same methods – the request only originates from the ST servers if you’re requesting a public IP or hostname. The bug with local requests to be fixed in the next release is that POST/PUT body is encoded incorrectly for anything other than the JSON request body option – so the server will likely reject FORM and CUSTOM requests.


#9

@ipaterson, I stand corrected. My fingers were typing faster than my brain was engaging. So, from our previous discussion, I will not have to use my public IP to do requests to my local Kodi once webcore handles the CUSTOM requests properly?


#10

Yep, exactly. Currently for local network requests the hub identifies CUSTOM requests as XML regardless of the content type that is selected in webCoRE.


#11

I am trying to get this URL: http://192.168.86.205/MainZone/index.put.asp?cmd0=PutZone_OnOff%2FON

The URL works locally. However, I setup a piston with a “Make A Web Request” (Hub is on our same subnet/network/etc). However, the URL is simply not fired with the IF condition is met.

Any ideas? Seems like it should be pretty straightforward but I can’t get that URL to fire no matter what.

deved


#12

What do you get for $httpStatus and code?


#13

What is that and how do I get it?


#14

This?


#15

Sorry, I meant after your make web request task, add a log to console task to reflect the $httpStatus and $httpStatusCode variables. Also it works help to see the piston you have that makes there web call.


#16

Wow… I was using CoRE not webCoRE. All …uh… “fixed”…


#17

@devedsmith - Long time since you wrote this, but any chance you have a working piston making an HTTP call to an AV receiver? I’m struggling and would love to see an example!


#18

Not sure this will help, but here is mine. I call my Kodi (on a RPi) and my Russound AV receiver (using a Telnet connection).


#19

No, @kthinnes, this never worked. It does not appear to be implemented correctly as it never fires locally or from the cloud (via our public facing static IP with ports open and forwarded to the device). I also tried this with URL tracking/trackback services to get a response and it simply never fires from WebCore.

Since then, I’ve moved on. This whole process was overly complex for a simple thing. Smartthings integrated Denon controls into their updated driver so … problem solved.