editorialNotes always nil when fetching the Artist model in MusicKit API

For some reason no matter witch approach to take to get editorialNotes from Artist struct it always returns nil.

The first approach is to use MusicCatalogResourceRequest - from MusicKit2 framework like this

let album = try await album?.with(.artistURL)
guard let url = album?.artistURL else { return }

let id = MusicItemID(url.lastPathComponent)
let request = MusicCatalogResourceRequest<Artist>(matching: \.id, equalTo: id)
let requestScopes: [PartialMusicAsyncProperty<Artist>] = [.latestRelease, .featuredAlbums, .fullAlbums, .liveAlbums, .singles, .compilationAlbums, .similarArtists]

let response = try await request.response()
guard let artistResponse = response.items.first else { return }

let detailedArtist = try await artistResponse.with(requestScopes)
self.artist = detailedArtist

Or to use MusicKit1 endpoint like this. GET https://api.music.apple.com/v1/catalog/{storefront}/artists/{id}

let url1 = URL(string: "https://api.music.apple.com/v1/catalog/us/artists/\(url.lastPathComponent)")!
let urlRequest = URLRequest(url: url1)
let artistRequest = MusicDataRequest(urlRequest: urlRequest)

let arstistResponse = try await artistRequest.response()
let decoder = JSONDecoder()
let receivedArstist = try decoder.decode(MusicItemCollection<Album>.self, from: arstistResponse.data)

if let json = try JSONSerialization.jsonObject(with: arstistResponse.data, options: []) as? [String: Any] {
    print(json)
}

For test purposes I try to put in in JSON to print out and see if editorialNotes have some value. Maybe this is a bug, please let me know how to get editorialNotes

Answered by snuff4 in 738681022

From my testing, I have observed that the albums usually have standard editorial notes. But for artists, the editorial notes are under the "short" editorial notes. I hope that helps!

Also, some artists may not have editorial notes, so something to keep in mind.

Accepted Answer

From my testing, I have observed that the albums usually have standard editorial notes. But for artists, the editorial notes are under the "short" editorial notes. I hope that helps!

Also, some artists may not have editorial notes, so something to keep in mind.

editorialNotes always nil when fetching the Artist model in MusicKit API
 
 
Q