Question
· Sep 23, 2022

HTTP request hanging

Hi Guys,

I'm able make a request through the browser with no issues as below: 

http://ac1.mqtt.sx3ac.com/api/gap/nodes?filter_rssi=-75&chip=1&mac=CC:1B:E0:E2:3C:10&access_token=36f29cd37f969a7403c78270f11f57b6ceee522456ad803c6095497e95a9f234&active=1&event=1
 

 

so I created this code to do the same but, when running the method from terminal the process just hangs and not doing anything not sure why? 

 

ClassMethod GetTempFromAC()
{

Token=##class(MSDS.SpaceSense.API).GetAuth()
Set Httprequest=##class(%Net.HttpRequest).%New()
//Set Httprequest.SSLConfiguration="RTLS"
Set Httprequest.Server="ac1.mqtt.sx3ac.com"
Set Httprequest.Timeout=30
    //Set Httprequest.Port=9981
Set Httprequest.Https=0
set Httprequest.ContentType=" application/json"
Do Httprequest.SetHeader("Accept"," application/json")
Do Httprequest.SetHeader("Accept-Language","en_US")
Do Httprequest.SetHeader("Authorization","Bearer "_Token)
Set HttpURL="/api/gap/nodes?filter_rssi=-75&chip=1&mac=CC:1B:E0:E2:3C:10&active=1&event=1"
Set tSc=Httprequest.Get(HttpURL)
  BLEConnect=Httprequest.HttpResponse.StatusLine
  !,BLEConnect

 

 

Thanks

Product version: Caché 2014.1
Discussion (1)1
Log in or sign up to continue

Does it work with something like Postman? I'd probably look at it with something like JOBEXAM to see what line of code it is executing. Maybe there is something specific browser based that it is passing that you have to define explicitly in the HTTP request.  Also suggest to try in a later Cache or IRIS version.
If you need help debugging feel free to open a WRC case with us.

-Len