latest and top releases of a record label

Hi there!

I am trying to fetch a record label's top and latest releases. For example, for "Big Machine Label Group", I can see the top and latest releases on Apple Music.

I get the latest and top releases if I use the endpoint to get a catalog record label and query parameters to extend.

https://api.music.apple.com/v1/catalog/us/record-labels/1552967199?views=top-releases,latest-releases

However, I am getting nil for these values using MusicCatalogResourceRequest. Here's the code:

let request = MusicCatalogResourceRequest<RecordLabel>(matching: \.id, equalTo: "1552967199")
let response = try await request.response()

guard let recordLabel = response.items.first else { return }

print(recordLabel.topReleases)
print(recordLabel.latestReleases)

I cannot add properties for these either to get detailed info because I think there is no PartialMusicProperty when Root is RecordLabel.

Can you point me to what I am doing wrong?

Answered by Frameworks Engineer in 716939022

Hello @snuff4,

This issue is resolved in iOS 16 beta 1.

Just make sure to load the .latestReleases and .topReleases properties of the RecordLabel.

You can even use these APIs on older deployment targets, as long as you use the latest SDK to build your app.

I hope this helps.

Best regards,

Hello @snuff4,

Thank you very much for your question about loading the topReleases and latestReleases for a RecordLabel using MusicKit.

You're doing nothing wrong, and you're correct when you say that you:

cannot add properties for these either to get detailed info because [...] there is no PartialMusicProperty when Root is RecordLabel.

This is such a shame, we did all our due diligence to be able to expose those symbols, but we simply forgot to add the public keyword next to them, which explains why you don't see them in the public SDK or in the documentation.

We will address this next chance we get.

Meanwhile, if you really need to get this data in Swift before we can ship this fix in the SDK, you could use MusicDataRequest as a temporary workaround.

let url = URL(string: "https://api.music.apple.com/v1/catalog/us/record-labels/1552967199?views=top-releases,latest-releases")!
let dataRequest = MusicDataRequest(urlRequest: URLRequest(url: url))
let dataResponse = try await dataRequest.response()

let decoder = JSONDecoder()
let recordLabels = try decoder.decode(MusicItemCollection<RecordLabel>.self, from: dataResponse.data)

guard let recordLabel = recordLabels.first else { return }

print("recordLabel.topReleases = \(String(describing: recordLabel.topReleases))")
print("recordLabel.latestReleases = \(String(describing: recordLabel.latestReleases))")

I hope this helps.

Best regards,

Any update on this? It is still returning nil in Xcode 13.4

Hello @snuff4,

I’m afraid we did not have bandwidth to address this specific issue in the most recent version of iOS and the corresponding SDK.

We will investigate this for possible inclusion in a future update.

Thanks,

Accepted Answer

Hello @snuff4,

This issue is resolved in iOS 16 beta 1.

Just make sure to load the .latestReleases and .topReleases properties of the RecordLabel.

You can even use these APIs on older deployment targets, as long as you use the latest SDK to build your app.

I hope this helps.

Best regards,

latest and top releases of a record label
 
 
Q