Search code examples
iosiphoneitunesaffiliate

Redirect to iTunes music store for a keyword on both web and mobile?


I'm trying to redirect a user to the iTunes store for a specific song.

I went through the Apple iTunes's affiliate documentation and found their Search API but that returns JSON data for a specific query and requires post processing at my end. I'm really not looking at going through this effort of identifying the track. What I'm looking for is to redirect the user to the iTunes store for a specific query.

I found a link on 8tracks's website that redirects the user to a keyword on the iTunes store. The link for that is

https://search.itunes.apple.com/WebObjects/MZSearch.woa/wa/search?term=my+search+term&at=XXXXXX

This works fine on the web but on an iPhone, it redirects the user to the iTunes page with the search term enclosed in round brackets and quotes. For the above search term it would search for ('my search term'). Does anybody have any idea why this would happen and a way to go around this? Also does anyone have info whether this is a valid iTunes Affiliate technique? I haven't found this link any of Apple's documentation so far.


Solution

  • Using itms://itunes.apple.com/WebObjects/MZStore.woa/wa/search as the base URL did the trick for me.

    So the complete URL is:

    itms://itunes.apple.com/WebObjects/MZStore.woa/wa/search?term=my+search+term&at=XXXXXX&media=music&entity=song