iTunes ID for Apple's Search API

5.6k Views Asked by At

What is the correct "iTunes ID" for looking up songs with Apple's Search API (http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html)?

Is it the 64 bit "persistent identifier" that can be requested from iTunes' COM interface for a given track? Something else?

Probably something else, because all iTunes IDs I've found in examples are way shorter than 64 bits.

1

There are 1 best solutions below

0
On

If you examine the output of the query term searches, you can see the ID is a property returned by other searches (here it's artistId)

http://itunes.apple.com/search?term=jack+johnson

returns

{
 "resultCount":50,
 "results": [
    {"wrapperType":"track", "kind":"feature-movie", "artistId":909253,
    ... [etc] ...
}

The artistId is then used in the later example to search by "iTunes ID"

Look up Jack Johnson by iTunes artist ID: http://itunes.apple.com/lookup?id=909253

Songs are by trackId (e.g. the first song returned by the search for "Jack Johnson" is "trackId":120954025. Albums are collectionID. Without knowing the Ids beforehand, you'll probably have to find them from text query searches.