How to query both personal music collection and Spotify catalog for specific musicians or music styles

I’m building a custom application that works with Spotify’s API. Users need to pick between searching their personal music collection or the main Spotify catalog.

I want to find specific musicians or music styles in both the user’s saved music and Spotify’s full database. Here’s what I tried:

var musicQuery = new models.Search("eminem");

musicQuery.localResults = models.LOCALSEARCHRESULTS.APPEND;

musicQuery.observe(models.EVENT.CHANGE, function() {
    musicQuery.artists.forEach(function(musician) {
        console.log(musician.name);
    });
});

musicQuery.appendNext();

But I keep getting these errors:

Uncaught TypeError: Cannot read property ‘APPEND’ of undefined
Uncaught TypeError: Object has no method ‘observe’

Does anyone know the right way to search through both the user’s saved tracks and Spotify’s main catalog? Do I need to use a different library to make this work? Any suggestions for external tools that can handle this kind of music search functionality would be really helpful.

you might be using a really old API version. Check out the latest Web API, it’ll require separate requests for ur saved tracks (/me/tracks) and the catalog search (/search). that models.Search thing isn’t in the current API anymore.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.