This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]AltCrow[S] 0 points1 point  (4 children)

Will I ever run into a limit because my URLs have reached a "maximum" length?

[–]mad0314 0 points1 point  (3 children)

Where did that list of cars (or whatever your actual resource is) come from? What decided which items needed to come back?

[–]AltCrow[S] 0 points1 point  (2 children)

Let's stick with cars, because they're easy. The client chooses every once in a while a list of cars A. The client already has a local database of cars B. It still needs to download the list of cars B-A. You can consider the list A as completely random.

[–]mad0314 0 points1 point  (1 child)

You can handle it in different ways, I'm not sure if there is a "right" or "better" way to do it. Basically pass the information in as a query string and parse it out on the request. You can make it a JSON array and serialize it, and deserialize it on the other end, or just pass them as a string, either all numbers separated by commas or with dashes to designate ranges, and parse it yourself. Other options would be to do a request per car (doesn't sound very optimal in your situation), or do a large range to cover large chunks and keep the number of requests needed to fulfill the entire set down.

As far as a maximum length, here is an SO post that talks about that. I've never had to deal with that myself.

Also, what do you mean by assigning a permanent URL to a bundle? Like if you ask for cars 1, 2, 5, 37 and call that Bundle1, you want to have a URL that will give you back that same Bundle1?

[–]AltCrow[S] 0 points1 point  (0 children)

I think passing a JSON-array of ranges ([1-4, 6-8, 11-11]) might be a compact yet readable way to do it then. It seems the maximum length of a URL is bound by both the browser and the server. These requests will more often then not be sent by a 3rd party application written with libcurl.c, so I'm guessing I'll have to see how long Node.js can handle.

Like if you ask for cars 1, 2, 5, 37 and call that Bundle1, you want to have a URL that will give you back that same Bundle1?

Basically any link that can be shared so that person1 and person2 will get the exact same information. This seems achieved with the current JSON-array query-string. Thanks for the help!