jasongullickson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012
08:16 AM
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:
The result in the console is:
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'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
4 REPLIES 4
renojim
Community Streaming Expert
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012
08:46 AM
Re: roUrlTransfer.GetToString() returns nothing (empty strin
I think you need to add:
-JT
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.
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.
jasongullickson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012
08:55 AM
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!
I tried those as-is without success; should I be supplying a value for the second argument of AddHeader?
Thank-you for your help!
RokuChris
Roku Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012
09:09 AM
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
http://sdkdocs.roku.com/display/RokuSDK ... Stringpath
xfer.SetCertificatesFile("common:/certs/ca-bundle.crt") ' or another appropriate certificate
xfer.InitClientCertificates()
jasongullickson
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2012
09:15 AM
Re: roUrlTransfer.GetToString() returns nothing (empty strin
Perfect, thank-you!