6

I am trying to make my app work with as little maintenance as possible, but also be as efficient as possible. Hence I would really like to batch up the ids I am requesting into a vector and get them with one call to the API.

However Kevin Montrose sates that the maximum number of parameters isn't in the specs because:

This isn't spec'd in the API because we'll change it whenever we please - for one, .NET 4 knocks that up iirc - and relying on it isn't supported.

So in other words I can only be sure that one id parameter will work?

Wouldn't it make sense to have a function that can be used to get the max query length or defining a value that it won't drop below for that version of the api?

It could also be good to have it defined as to what makes up the path. code poet suggests (bolding mine):

this test shows that ~290 is the max path including protocol but it seems to waver quite a bit so I am guessing that urlencoding of the semicolons is being counted on the other end.

2
  • Yes, the vectorized lists should definitely be in the parameter part of the URL, so that you are able to request any number of ids without worrying about the request succeeding. Commented Jun 30, 2010 at 3:30
  • 1
    @igor and yacoby - you might be interested in making your desires known by showing support for this stackapps.com/questions/751/… Commented Jun 30, 2010 at 4:12

1 Answer 1

3

The maximum allowed number of id in a vectorized list is 100, the max page size.

The practical limit is undefinable because id are of arbitrary length and the limitation is on the length of the path component of the request url and is imposed by the server infrastructure, not the API software itself.

Until the id component is moved into the query string, you must make efforts to monitor your path length so as to avoid (400) Bad Request.

As you note, I have provided an example of what seems to me to be the only strategy for handling this issue here

I have constructed many batches containing semi-delim lists of varying id length and have come to the personal conclusion that 240 (semis are not encoded) is a very very safe bet.

So when I batch up, I subtract then length of my url, less the id component, from 240 and that is my max batch length, i.e. the longest my vectorized list can be.

Right now, there really is no other solution.

You can indicate your desire to have the Id moved into the query string here

1
  • Boy, I haven't used vectorized lists in any of my apps... now I know why. Commented Jun 30, 2010 at 4:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .