Access a 3rd person's playlist via Apple Music API

HI there,


I'm writing a web app and one of the feature's I want to implement is reading another user's playlist.


Ideally, I'd like to do this using the Apple Developer token only, without the app having to authenticate as an Apple Music user.


Assumptions are:

  • I would know the id of the user who's playlist I want to find/access in order to gain a list of that user's public playlists.
  • I know the id of the playlist that I want to get.


I've tryied "Get a Catalog Playlist" as described here, but it returns a "resource not found" error.


And I've tryied "Search for Catalog Resources" as described here, but it returns empty results.


I"m wondering if there is a way to do what I'm trying, or if I'm barking up the wrong tree here.


Thanks,


Kim

Replies

I'm answering my own question here, in case someone else is looking for this info.


The trick is to use Get a Catalog Playlist and where it says "id", use the "globalId" located in attributres.playParams of the playlist object.


And, for the record, the user does not need to sign into in order for the API to make this call as the Authorization is done with the Apple developer token.


Here's an example using axios with a "us" storefront:


const getOptions = {
      method: "GET",
      url: `https://api.music.apple.com/v1/catalog/us/playlists/${globalId}`,
      headers: {
        Authorization: "Bearer " + appleDeveloperToken,
        "Content-Type": "application/json"
      }
    };
    const { data } = await axios(getOptions);


If anyone knows of a better way, I'm all ears.