Upper limit for bulk requests

Upper limit for bulk requests

in API Development

Posted by: StevenL.3761

StevenL.3761

Not all /v2 endpoints support the “ids=all” identifier, but there doesn’t seem to actually be a limit on the number of identifiers that you are allowed to request in a single HTTP GET? I’ve noticed that it does break when the URL reaches some length. I’m not sure what’s up with that.

Upper limit for bulk requests

in API Development

Posted by: Alcarin.9024

Alcarin.9024

Max URL length is about 2000 characters (not technically 2000, but it’s better to use this as max), so it can contain at maximum about 324 item_id assuming that each item_id is 5 character length.


https://api.guildwars2.com/v2/commerce/listings?ids=” is 52 character length;
item_id is maximum 5 character length + 1 comma to separate items;
(2000-52)/6=324.83

I’ve not done any test yet, but if GW2 APIv2 have no limit, you should consider to limit number of item_id to 320 per request to be sure to not get any errors.

Upper limit for bulk requests

in API Development

Posted by: darthmaim.6017

darthmaim.6017

Using a too large page_size will return the max amount of objects returned by the api in the error message, for example https://api.guildwars2.com/v2/commerce/listings?page=0&page_size=1000 returns 200

Upper limit for bulk requests

in API Development

Posted by: StevenL.3761

StevenL.3761

The same limit does not apply to “ids” requests. I can request over 200 identifiers just fine. So it seems that there is no limit. Strange…

Upper limit for bulk requests

in API Development

Posted by: Alcarin.9024

Alcarin.9024

Number of ids are limited by the URL length, so the response cannot return more than about 500 items assuming ids of 2 or 3 characters, or about 320 with ids of 5 characters (if I’m correct, most of the items have ids with 5 characters). So it’s not needed to limit the amount of items in order to avoid long DB query.
On the other hand, using pagination could very easily cause long query if the number of object per page are too much, so a check to limit the amount of items per page is needed.
This decision make sense to me. Especially if items returned with pagination have some sort of ordering.
The only thing that could be “strange” is the difference between 200 items with pagination, and the 300 items with ids. But probably the only reason why this seems strange to us, it’s that we don’t know DB structure.

Upper limit for bulk requests

in API Development

Posted by: StevenL.3761

StevenL.3761

So I guess I’ll implement an artificial limit of 200 identifiers in my code. Otherwise, I get problems where the API crashes and returns plain html when the URL becomes too big.

Upper limit for bulk requests

in API Development

Posted by: Stephane Lo Presti

Stephane Lo Presti

Content Marketing Manager, French

Next

Hi,

We aware of the bug for Item IDs greater than 200 and have a fix which will be pushed in a future patch.

Thanks for reporting this to us.

Upper limit for bulk requests

in API Development

Posted by: Alcarin.9024

Alcarin.9024

Thank you for the info Stephane!

Upper limit for bulk requests

in API Development

Posted by: Pat Cavit.9234

Previous

Pat Cavit.9234

Web Programming Lead

This was deployed a few days ago, would love to know if the bug’s still happening.

Upper limit for bulk requests

in API Development

Posted by: StevenL.3761

StevenL.3761

“id list too long; this endpoint is limited to 200 ids at once”

Looks okay to me.