Step 1, get yourself an API key.
Step 2, get jQuery.
I used the AJAX option in jQuery. It's easy to setup and you can specify a return type.
Here is the ajax call I setup that grabs page 1 of the results.
Make a call to jquery, I have 1.3.2. Setup a document.ready function and in there setup your ajax call. specify the type, url, I set the cache to true and the success: option. DataType will either be xml or json. This will match the format you choose in the URL you pass to Remix.
$(document).ready(function(){
$.ajax({
type: "GET",
url: ""http://api.remix.bestbuy.com/v1/products?page=1&apiKey=YOURKEYHERE&format=json&callback=?,
cache: true,
success: function(data) {
alert('test');
},
The simple thing for testing is just put an alert right here. If successful, the alert fires.
dataType: 'json"
)};
)};
Once you have everything working, just put jQuery's version of a "for" loop in. $.each
$.each(data.products, function(i,products) {
your formatting here. here's mine
$('').html("SKU: " + this.sku).appendTo('#results');
});
Results is my main div that I just add stuff too for testing. You'll want some formatting here.
Nice post, we'd love to know what you think and are doing with the API.
ReplyDeleteBryan
Remix Team
@bestbuyremix
I'm going to publish a Remix web page and add some pizazz...and add a few different APIs on it and try and tie the Remix service with an Adobe AIR widget. Then maybe check out the affiliates program..
ReplyDelete