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: 
jbrave
Channel Surfer

maximum URL length?

Is there a limit to the size of urls that an RoUrlXfer will digest?

xfer = CreateObject("roURLTransfer")

xfer.seturl("http://www.google.com")

?xfer.geturl()

http://www.google.com

url="http://api.soundcloud.com/tracks.xml?consumer_key=----------------------&limit=21&offset=0&order=hotness&created_at[from]=2010-8-24"

xfer.seturl(url)

?xfer.GetUrl()

http://www.google.com

xfer.SetUrl("http://www.ibm.com")

?xfer.GetURl()

http://www.ibm.com

xfer.setURL("http://api.soundcloud.com/tracks.xml?consumer_key=----------------------&limit=21&offset=0&order=hotness&created_at[from]=2010-8-24")

?xfer.GetURl()

http://www.ibm.com

So that is why I've been tearing my hair out... Is this a bug or is there a reason for this? Any useful workarounds? now I know why my app broke last night when I added "&created_at[from]=2010-8-24" to the end of the URL, and why it broke in a way I couldn't trace easily (poster items showing up in the wrong category... because the URL didn't change)
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
17 REPLIES 17
TheEndless
Channel Surfer

Re: maximum URL length?

I think the problem is actually with your URL itself, not the length. You should URL encode your square brackets...

http://api.soundcloud.com/tracks.xml?consumer_key=----------------------&limit=21&offset=0&order=hotness&created_at%5bfrom%5d=2010-8-24
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
renojim
Community Streaming Expert

Re: maximum URL length?

The problem is the square brackets. Replace them with %1B and %1D respectively.

Endless beat me to it!

-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
TheEndless
Channel Surfer

Re: maximum URL length?

"renojim" wrote:
The problem is the square brackets. Replace them with %1B and %1D respectively.

Endless beat me to it!

-JT

%5B and %5D... not 1...
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
jbrave
Channel Surfer

Re: maximum URL length?

Would there be any benefit / problem with running the whole URL through URLEncode?
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
renojim
Community Streaming Expert

Re: maximum URL length?

I've had mixed results with UrlEncode. I'd try it with whatever site you're trying to connect to and see if it works. In my case, I wanted some things encoded but not others and encoding everything didn't work. I believe it should work, but you never know until you try.

-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
renojim
Community Streaming Expert

Re: maximum URL length?

"TheEndless" wrote:
"renojim" wrote:
The problem is the square brackets. Replace them with %1B and %1D respectively.

Endless beat me to it!

-JT

%5B and %5D... not 1...


Oops! That's what I get for trying to beat you to the punch!

-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
TheEndless
Channel Surfer

Re: maximum URL length?

You can't do the whole URL, because it will encode the slashes, ampersands, and equals. You only want to URL encode the querystring parameters and values.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
kbenson
Visitor

Re: maximum URL length?

"TheEndless" wrote:
You can't do the whole URL, because it will encode the slashes, ampersands, and equals. You only want to URL encode the querystring parameters and values.


And just so it's completely obvious to anyone who's just learning this, you encode the parameters and values not the whole query string. That is, you can't encode "foo=bar&this=that" as the "=" and "&" will be encoded (that's how you pass them in as variables). You need to encode each parameter name and value separately.
-- GandK Labs
Check out Reversi! in the channel store!
0 Kudos
jbrave
Channel Surfer

Re: maximum URL length?

Ok, so just to make sure I get it, what is the criteria for whether a character should be URL encoded? one website I looked at said "all non-alphanumerics", but I think I really only want the "weird" characters like spaces and brackets?

- Joel
Screenshades: The first Screensaver for Roku2!
Musiclouds: The best free internet music, on your Roku!
Ouroborialis: Psychedelic Screensaver for Roku!
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.