I have this code chunk that does an API request and should save the response to a file, but it doesn't. 'channel' is a String.
plReq = CreateObject("roURLTransfer")
plReq.AddHeader("Client-ID", *my API key*)
plReq.SetURL("https://usher.twitch.tv/api/channel/hls/" + channel + ".m3u8?player=twitchweb&token=" + resp.token.tostr() + "&sig=" + resp.sig.tostr() + "&allow_audio_only=true&allow_source=true&type=any&p=" + "7333049")
' configure SSL certs
plReq.SetCertificatesFile("common:/certs/ca-bundle.crt")
plReq.AddHeader("X-Roku-Reserved-Dev-Id", "")
plReq.InitClientCertificates()
code = plreq.GetToFile("tmp:/" + channel + ".m3u8")
When I look in the debugger, I see that code = -3, so I assumed that there was something wrong with the GET Request.
code Integer val:-3 (&hFFFFFFFD)
I then tried to print the url associated with plReq to see if it was being set properly and it seems like the url string is empty
Brightscript Debugger> p plreq.geturl()
Brightscript Debugger>
The only thing I can think of is that SetUrl() expects a String, not a roString. But I am unsure of how to convert the object back to an intrinsic as I need to be able to concatenate to build the url in the first place. Any help is appreciated.