Search code examples
best-buy-api

How can I list which stores have an item in stock?


I'm searching for a particular item that is listed as available for in-store pickup only, but not in my area.

I'd like to use the API to find out which stores do have that item in stock so I can phone a friend that lives in one of those areas and get them to pick it up.

So... How can I list the stores that have a particular item in stock?

Answer

The geographic center of the United States is 39°50' (39.8333), -98°35' (-98.5833)

The width United States is approximately 3,000 miles.

So if we search a radius of 2000 miles in any direction from that point we get:

http://api.remix.bestbuy.com
  /v1/stores(area(39.8333,-98.5833,2000mi))
  +products(sku=YOUR_SKU_ID)
  ?format=json
  &pageSize=100
  &page=1
  &show=storeId,storeType,city,region,name,products.name,products.sku,products
  &apiKey=YOUR_API_KEY

http://api.remix.bestbuy.com/v1/stores(area(39.8333,-98.5833,2000mi))+products(sku=6461052)?format=json&pageSize=100&page=1&show=storeId,storeType,city,region,name,products.name,products.sku,products&apiKey=YOUR_API_KEY

And you'll be surprised that while 1419 stores have Black Ink'd Skullcandy Earbuds in stock the day before Christmas, 0 of them have the Marth Amiibo, and 67 have the Star Fox Amiibo... who knew?


Solution

  • The API does provide a way to check for product availability in specific stores. Here is an example query (you need to substitute in your own apiKey) that uses coordinates and a radius within which to search:

    http://api.remix.bestbuy.com/v1/stores(area(44.882942,-93.2775,10mi))+products(sku=6461052)?apiKey=yourApiKey&format=json&show=storeId,storeType,city,region,name,products.name,products.sku,products

    There is documentation about this feature here: https://developer.bestbuy.com/documentation/stores-api#documentation/stores-api-in-store-availability

    You will find in the documentation that you can also search for availability at a specific store, or use a postal code. But I think using the coordinates may fit the case described in your question best.