Quantcast
Channel: The Echo Nest Developer Forum
Viewing all articles
Browse latest Browse all 1582

Unable to use multiple buckets at same time

$
0
0

Your parameters are being overwritten by JavaScript; you actually want to define your parameters this way:

var parameters = { "api_key": "12345678",
                   "results": "2", "start": "0", "bucket": ["id:7digital-US", "familiarity",  
                                                             "hotttnesss", "images"]};

If you cut and paste your parameters definition into the browser, and take a look at the resulting object, you'll see it only has one value for bucket.

I'd also not bother with JSONP. If you have a modern version of jQuery, it's also helpful to do the success and error functions using the promise API. I'd make the call to the Echo Nest like this:

$.ajax({dataType:'json', 'url':'http://developer.echonest.com/api/v4/artist/top_hottt',
        data:parameters, traditional: true})
 .then(function(data){
           getArtists(data.response.artists);
       }, function(){
           console.log('error', arguments);
       }

The interesting change here is the traditional:true. This tells jQuery to serialize your array into a form it can understand.


Viewing all articles
Browse latest Browse all 1582

Trending Articles