Upper limit for bulk requests
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.
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
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…
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.
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.
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.
Thank you for the info Stephane!
This was deployed a few days ago, would love to know if the bug’s still happening.
“id list too long; this endpoint is limited to 200 ids at once”
Looks okay to me.