How do I fetch a song without identifier with Apple Music api?

right now to fetch a song in Apple Music api, I need the identifier of the song. but my webapp only has access to the track title, album name and artist name. I need to create affiliate urls automatically for many songs.

Replies

You'll have to use those names to call the web service to do a catalog search for the identifier, via https GET to api.music.apple.com and e.g. /v1/catalog/\(countryCode)/search. There's an example of this in Apple's sample code called Interacting with Apple Music Content/Adding-Content-to-Apple-Music and explained in the video at WWDC 2017 Introducing MusicKit.