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

I think you need to add:

api.AddHeader("X-Roku-Reserved-Dev-Id", "")
api.InitClientCertificates()

-JT

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!

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()

Perfect, thank-you!