3

I'm developing an iOS application which retrieves a song ISRC from an external source. I then need to use Apple's MusicKit SDK to get the song in Apple Music/iTunes, using the ISRC. Is it possible to do this? The Song resource type has the ISRC in the song attributes which is returned whn you do a GET request for a song, but the request uses the Apple Music song ID to perform the lookup. So can I query Apple Music for a song, using the ISRC instead? Also happy to look it up on the iTunes Search API and then get the ID (I think they're the same across Apple Music and iTunes?) and then query the Apple Music API using that ID.

I also asked this question on the Apple Developer MusicKit forum, but as of yet, no-one has answered me.

Tom Oakley
  • 6,065
  • 11
  • 44
  • 73
  • Hi @Tom Oakley I am fetching Apple Music Playlists and tracks into my App, In my App settings screen I have added a Switch to show/hide Explicit songs of Apple Music. Can you suggest me how can I get to know wether the song is Explicit or not? Thank you in Advance. – Anand Gautam Mar 19 '19 at 06:41
  • @AnandGautam I'm unsure Anand, it would be best to ask a new question to get an answer to that. – Tom Oakley Mar 19 '19 at 12:39
  • I have asked the same (Link: https://stackoverflow.com/questions/55235773/how-to-find-explicit-songs-on-apple-music-user-playlists-ios), now got resolved. Thank you for your response @Tom Oakley! – Anand Gautam Mar 19 '19 at 13:07

2 Answers2

10

This was just highlighted at WWDC 2018. You can perform an request directly to the Apple Music API to

GET https://api.music.apple.com/v1/catalog/{storefront}/songs?filter[isrc]=ISRCSTRING

If you are using the new MusicKit JS library, you can perform the lookup with the following JavaScript:

MusicKit.getInstance().api.songs({ filter: { isrc: 'ISRCSTRING' } }).then(function(songs) {
    console.log(songs); // Array of songs matching ISRCSTRING
})
Jae Hess
  • 141
  • 1
  • 5
1

Looks like it is available given I see this in the response:

"isrc": "USQX91700278"

For this song request: https://api.music.apple.com/v1/catalog/us/songs/1207120448

  • Thanks Ravi. Yeah I found that, but I need to make a request like ?isrc=USQX91700278. Thanks for answering though – Tom Oakley May 04 '18 at 20:09