开云体育

ctrl + shift + ? for shortcuts
© 2025 Groups.io

https Get request through Crestron vs. browser


 

I'm trying to make an https get request to retrieve some weather information from the national weather service.? If I paste the url into the address bar of chrome it works perfectly.? If I make the exact same https get request through S# (vs2008) on a CP4 I get a response code of 403 - forbidden.

Any ideas on how to get the request to work through a Crestron processor would be greatly appreciated.

Thanks in advance for the help

Jay


 

Are you including all the appropriate header information?
i have done http with both vs2008 and vs2018 with S#Pro and it generally works pretty good. ?

you could use postman to validate your headers and url. ?


 

开云体育

Thanks.? I was thinking that was the issue.? But, I know that chrome puts out a lot of header info and I was hoping someone might have an idea on what might be important vs just trying to include everything.

Thanks again

Jay

On 4/7/2023 6:37 PM, cmac_HT wrote:

Are you including all the appropriate header information?
i have done http with both vs2008 and vs2018 with S#Pro and it generally works pretty good. ?

you could use postman to validate your headers and url. ?


 

Using postman can help determine what is needed when making the requests. ?


 

Https requires encryption. You would need to use simpl# for that.?


On Fri, Apr 7, 2023, 7:31 PM jbasen <jay.m.basen@...> wrote:
I'm trying to make an https get request to retrieve some weather
information from the national weather service.? If I paste the url into
the address bar of chrome it works perfectly.? If I make the exact same
https get request through S# (vs2008) on a CP4 I get a response code of
403 - forbidden.

Any ideas on how to get the request to work through a Crestron processor
would be greatly appreciated.

Thanks in advance for the help

Jay







 

开云体育

I got it working.?

Thanks all

Jay

On 4/7/2023 7:01 PM, Crestron_Programmer_84 wrote:

Https requires encryption. You would need to use simpl# for that.?

On Fri, Apr 7, 2023, 7:31 PM jbasen <jay.m.basen@...> wrote:
I'm trying to make an https get request to retrieve some weather
information from the national weather service.? If I paste the url into
the address bar of chrome it works perfectly.? If I make the exact same
https get request through S# (vs2008) on a CP4 I get a response code of
403 - forbidden.

Any ideas on how to get the request to work through a Crestron processor
would be greatly appreciated.

Thanks in advance for the help

Jay







 

Hi Jay,

how did you get it working? Would love to see the solution. ?Been playing with this on and off when I get time. ?Posted this but no replies as yet.

/g/crestron/message/249489?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2CHttps%2C20%2C2%2C20%2C97628203


 

开云体育

There are quite a few examples on my GitHub of doing https communications using S#/C# with a product ().? You should be able to simply copy the basic code from one of those to get you started. In this case the specific request setup that I found worked for the national weather service was:

?? ???? ??? ??? request.KeepAlive = false;
?? ???? ??? ??? request.Header.SetHeaderValue("Accept", "text/html");
?? ???? ??? ??? request.Header.SetHeaderValue("Accept-Language", "en-US,en;q=0.9");
?? ???? ??? ??? request.Header.ContentType = "application/json";
?? ???? ??? ??? request.Header.SetHeaderValue("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64");
?? ???? ??? ??? request.RequestType = Crestron.SimplSharp.Net.Https.RequestType.Get;

I'm not sure which ones were critical vs. which ones chrome just included and the nws didn't care about but it worked and that was all that mattered to me.?

Any product that I've written a driver for that communicates with a web service is going to require https.? Ones that have local api's may not.? Also the newer drivers I've written will use newtonsoft for parsing returned json while in older ones I will manually parse the json.

Hope this helps

Jay

On 4/7/2023 11:04 PM, ScubaSteve wrote:

Hi Jay,

how did you get it working? Would love to see the solution. ?Been playing with this on and off when I get time. ?Posted this but no replies as yet.

/g/crestron/message/249489?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3ACreated%2C%2CHttps%2C20%2C2%2C20%2C97628203


 

Thank you