Get item_(sub)classes out of the auction house api

It seems this endpoint is actually capped at 1000 records per query. You can get 10 pages of 100 records, or only one page with 1000 records.

There is a workaround for this, we can use the min feature to get the next 1000 items by setting the minimum item ID to the next item from the last query:

https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&orderby=id&_pageSize=1000&id=[1]&_page=1&access_token= will return the first 1000 items, we then get the id of the last item (2429) and add one, then query the next 1000 like this:

https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&orderby=id&_pageSize=1000&id=[2430,]&_page=1&access_token=

$startingItem = 1;
do {
  $data = fetch("https://us.api.blizzard.com/data/wow/search/item?namespace=static-us&orderby=id&_pageSize=1000&id=[$startingItem,]&_page=1&access_token=");
  foreach ($data->results as $entry) {
    // Insert/update the item on your DB
  }
  $startingItem = $data->results[array_key_last($data->results)]->data->id + 1;
} while(count($data->results) > 0);

Important: While there is no restriction, we should wait on a blue answer as if this workaround is acceptable. It doesn’t seem like this endpoint was designed to allow such use, otherwise there wouldn’t be a cap.

2 Likes