Can i fetch default recommendations using the new MusicKit JS?

Hi!


I'm very excited about the possiblities of MusicKit on the web recently launched at WWDC 2018. There's a great example of it's functionality by Lee Martin on this Codepen : https://codepen.io/leemartin/pen/bKEeZL


I think that barring search, this pen pretty much sums it up. I'm just curious if it's possible to fetch the recommendations and recents using the apple music API as described in : https://developer.apple.com/documentation/applemusicapi/get_default_recommendations (which require a user token) with MusicKit JS. Has anyone tried this yet?


Cheers,

Chaithanya

You can!


The MusicKitJS library has a wrapper for basically everything the MusicKit API has - but the documentation isn't super great right now. My strategy is to call the things using MusicKitJS, then check the network tab in chrome to see the URL it hit, then look at the MusicKit documentation for the API to figure it out🕵♂


https://developer.apple.com/documentation/musickitjs/musickit/api


A basic example of getting your recommendations:


        MusicKit.getInstance().api.recommendations().then(function(recommendations) {
          console.log(recommendations);
        });


It seems to contain basically everything you get right now on the "For You" screen of Apple music.

Can i fetch default recommendations using the new MusicKit JS?
 
 
Q