Hi there!
How do I go about accessing the details of the curator?
For example, if I hit the following endpoint to access details about a playlist:
https://api.music.apple.com/v1/catalog/us/playlists/pl.047294ae14a24e5993d1f7ab2b127188
Then, in the response, I see the curator containing the ID under relationships:
"curator": {
"href": "/v1/catalog/us/playlists/pl.047294ae14a24e5993d1f7ab2b127188/curator",
"data": [
{
"id": "976439548",
"type": "apple-curators",
"href": "/v1/catalog/us/apple-curators/976439548"
}
]
}
Using this ID, I can get more information like the editorial notes, kind, artwork, etc.
If I use MusicKit to get details about the playlist:
let id = MusicItemID("pl.047294ae14a24e5993d1f7ab2b127188")
let request = MusicCatalogResourceRequest<Playlist>(matching: \.id, equalTo: id)
let response = try await request.response()
guard let playlist = response.items.first else { return }
print(playlist.curatorName)
It does not expose the Curator
object but only the curatorName
.
How can I access the ID of the curator?
Hello @snuff4,
I just wanted to let you know you no longer need to use MusicDataRequest on iOS 16 beta 1 to fetch the curator relationship of a Playlist.
Instead, you can load both the .curator and the .radioShow relationships of a playlist, and access them with the curator and radioShow accessors.
This is briefly mentioned in our new WWDC22 session video, Explore more content with MusicKit.
One thing to know though is that, if the curator
relationship of the playlist in Apple Music API happened to point to a resources of type AppleCurators and kind equal to "Genre"
, then you still won't be able to access it, because those resources are not yet exposed in MusicKit.
Best regards,