Overview

This package provides classes and methods for interacting with Best Buy's Remix API. Remix is an open API that gives you access to bestbuy.com's product catalog data.

The Remix developer site contains API documentation, discussion forums, and other related resources. A Remix API key may be obtained by signing up for an account on the site.

Getting Started

  1. Become familiar with the Remix API and apply for an API key at remix.bestbuy.com
  2. Download the JAR file for the most recent version of the Java API client.
  3. Copy the JAR to your project's class path.

Usage

While there are two "query types" described in the documentation, there are five basic types of information that you can request:

Remix provides methods for accessing each type of data listed above.

Collection resources may (or may not) be filtered using various criteria. Several examples follow:

Several query parameters may be submitted for purposes such as paging and sorting of collection results.

Filters are passed to an API call as a List. Parameters are passed as a Map of key/value pairs.

Basic example

import java.util.ArrayList;
import java.util.List;
import com.mattwilliamsnyc.service.remix.*;

Remix remix = new Remix("YourApiKey");

try {
    // Retrieve information about stores (paged results):
    StoresResponse response = remix.getStores();

    if(!response.isError()) {
        for(Store store : response.list()) {
            System.out.println("Store #" + store.getStoreId());
            System.out.println(store.getName());
            System.out.println(store.getHours());
            System.out.println(store.getPhone());
            System.out.println();
        }
    } else {
        ErrorDocument error = response.getError();
        System.out.println(error.getStatus());
        System.out.println(error.getMessage());
        for(String example : error.getExamples()) {
            System.out.println(example);
        }
    }
} catch(RemixException e) {
    e.printStackTrace();
}

Filters and parameters

// Retrieve a list of stores in New York City, ordered by name
List<String> filters = new ArrayList<String>();
filters.add("city=New York");
filters.add("region=NY");

Map<String,String> params = new HashMap<String,String>();
params.put("sort", "name");

StoresResponse response = remix.getStores(filters);
    

Store Availability

// Check for the availability of a PlayStation 3 near postal code 11201
List<String> storeFilters   = new ArrayList<String>();
List<String> productFilters = new ArrayList<String>();

storeFilters.add("area(11201,10)");
productFilters.add("sku=8982988");

StoresResponse response = remix.getStoreAvailability(storeFilters, productFilters);

if(!response.isError()) {
    for(Store store : response.list()) {
        System.out.println(store.getName() + " (" + store.getDistance() + " miles)");
        for(Product product : store.getProducts()) {
            if(product.hasInStoreAvailability()) {
                System.out.println(product.getName() + " available for $" + product.getSalePrice());
            }
        }
        System.out.println();
    }
}