Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

roUrlTransfer.GetToString() returns nothing (empty string?)

I feel silly asking this because it's probably something simple, but I poked around here and on the rest of the web and couldn't find a solution.

I'm trying to grab some JSON from an API. At the moment I'm not trying to parse it or anything, just want to see the results in the debugger. Here's the code:


'get the track list from the Murfie API
api = CreateObject("roUrlTransfer")
api.setUrl("https://www.murfie.com/api/discs/118451.json?auth_token=<redacted>")

'debug
print "result from the api call:"
print(api.GetToString())
print "end result"


The result in the console is:


result from murfie tracks api call:

end result


I have tried several variations (adding .setPort(), .addHeader(), etc.) but the result is always the same. I'm OK with using a blocking call like this (at least for now), but it's almost behaving like it's async (continuing processing before the result comes back).

For reference I'm using this inside of the AudioApp demo code; I didn't see anything that happens before this code runs that might interfere, but I thought I should mention it.

Any pointers appreciated, thanks!


Jason
0 Kudos
4 REPLIES 4
renojim
Community Streaming Expert

Re: roUrlTransfer.GetToString() returns nothing (empty strin

I think you need to add:
api.AddHeader("X-Roku-Reserved-Dev-Id", "")
api.InitClientCertificates()

-JT
Roku Community Streaming Expert

Help others find this answer and click "Accept as Solution."
If you appreciate my answer, maybe give me a Kudo.

I am not a Roku employee.
0 Kudos

Re: roUrlTransfer.GetToString() returns nothing (empty strin

Interesting; what do these two do exactly?

I tried those as-is without success; should I be supplying a value for the second argument of AddHeader?

Thank-you for your help!
0 Kudos
RokuChris
Roku Employee
Roku Employee

Re: roUrlTransfer.GetToString() returns nothing (empty strin

Any time you want to make an https:// request with roURLTransfer, you have to set the certificate file to be used.

http://sdkdocs.roku.com/display/RokuSDK ... Stringpath

xfer.SetCertificatesFile("common:/certs/ca-bundle.crt") ' or another appropriate certificate
xfer.InitClientCertificates()
0 Kudos

Re: roUrlTransfer.GetToString() returns nothing (empty strin

Perfect, thank-you!
0 Kudos