itunesStoreのWebAPIの利用方法

WebAPIなので使い方は単純です。
リクエストを投げて返ってくるJSONをパースするだけです。

今回はリクエストに関して書きたいと思います。
リクエストの仕様については、
http://www.apple.com/itunesaffiliates/API/AffiliatesSearch2.1.pdf
を参照してください。
仕様を読み進めた結果おおよそ以下のパラメータを利用すればよいことが分かりました。

term:検索キー。
country:カントリーコード。(これによって、どの国のituneStoreを利用するかが決まるようです。)
lang:言語。
media:検索対象とするメディア。(movie, podcast, musicなど。)
limit:検索結果表示数。

これらを組み合わせると、以下のようなURLになります。

例:マイケル・ジャクソンの曲を日本のitunesStoreで検索。表示数は5件。
http://ax.phobos.apple.com.edgesuite.net/WebObjects/MZStoreServices.woa/wa/wsSearch?term=Michael+Jackson&country=JP&lang=ja_jp&media=music&limit=5

term = Michael+Jackson
country = JP
lang = ja_jp
media = music
limit = 5


webブラウザでリクエストを投げると、以下のようなレスポンスがあるはずです。

{
 "resultCount":5,
 "results": [
{"wrapperType":"track", "kind":"song", "artistId":32940, "collectionId":14908862, "trackId":14908897, "artistName":"Michael Jackson", "collectionName":"The Very Best of Michael Jackson With the Jackson 5", "trackName":"Ben", "collectionCensoredName":"The Very Best of Michael Jackson With the Jackson 5", "trackCensoredName":"Ben", "artistViewUrl":"http://itunes.apple.com/jp/artist/michael-jackson/id32940?uo=4", "collectionViewUrl":"http://itunes.apple.com/jp/album/ben/id14908862?i=14908897&uo=4", "trackViewUrl":"http://itunes.apple.com/jp/album/ben/id14908862?i=14908897&uo=4", "previewUrl":"http://a1410.phobos.apple.com/us/r30/Music/b7/f8/a5/mzi.jsdjptmz.aac.p.m4p", "artworkUrl60":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.100x100-75.jpg", "collectionPrice":1050.00000, "trackPrice":150.00000, "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "discCount":1, "discNumber":1, "trackCount":21, "trackNumber":11, "trackTimeMillis":167333, "country":"JPN", "currency":"JPY", "primaryGenreName":"R&B/Soul"}, 
{"wrapperType":"track", "kind":"song", "artistId":32940, "collectionId":14908862, "trackId":14908915, "artistName":"Michael Jackson", "collectionName":"The Very Best of Michael Jackson With the Jackson 5", "trackName":"One Day In Your Life", "collectionCensoredName":"The Very Best of Michael Jackson With the Jackson 5", "trackCensoredName":"One Day In Your Life", "artistViewUrl":"http://itunes.apple.com/jp/artist/michael-jackson/id32940?uo=4", "collectionViewUrl":"http://itunes.apple.com/jp/album/one-day-in-your-life/id14908862?i=14908915&uo=4", "trackViewUrl":"http://itunes.apple.com/jp/album/one-day-in-your-life/id14908862?i=14908915&uo=4", "previewUrl":"http://a71.phobos.apple.com/us/r30/Music/bf/ab/78/mzi.tsgagpbx.aac.p.m4p", "artworkUrl60":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.100x100-75.jpg", "collectionPrice":1050.00000, "trackPrice":150.00000, "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "discCount":1, "discNumber":1, "trackCount":21, "trackNumber":17, "trackTimeMillis":257427, "country":"JPN", "currency":"JPY", "primaryGenreName":"R&B/Soul"}, 
{"wrapperType":"track", "kind":"song", "artistId":32940, "collectionId":14908862, "trackId":14908883, "artistName":"Michael Jackson", "collectionName":"The Very Best of Michael Jackson With the Jackson 5", "trackName":"Got to Be There", "collectionCensoredName":"The Very Best of Michael Jackson With the Jackson 5", "trackCensoredName":"Got to Be There", "artistViewUrl":"http://itunes.apple.com/jp/artist/michael-jackson/id32940?uo=4", "collectionViewUrl":"http://itunes.apple.com/jp/album/got-to-be-there/id14908862?i=14908883&uo=4", "trackViewUrl":"http://itunes.apple.com/jp/album/got-to-be-there/id14908862?i=14908883&uo=4", "previewUrl":"http://a946.phobos.apple.com/us/r30/Music/af/93/28/mzi.iuqjwwgq.aac.p.m4p", "artworkUrl60":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.100x100-75.jpg", "collectionPrice":1050.00000, "trackPrice":150.00000, "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "discCount":1, "discNumber":1, "trackCount":21, "trackNumber":7, "trackTimeMillis":204867, "country":"JPN", "currency":"JPY", "primaryGenreName":"R&B/Soul"}, 
{"wrapperType":"track", "kind":"song", "artistId":32940, "collectionId":14908862, "trackId":14908889, "artistName":"Michael Jackson", "collectionName":"The Very Best of Michael Jackson With the Jackson 5", "trackName":"Ain't No Sunshine", "collectionCensoredName":"The Very Best of Michael Jackson With the Jackson 5", "trackCensoredName":"Ain't No Sunshine", "artistViewUrl":"http://itunes.apple.com/jp/artist/michael-jackson/id32940?uo=4", "collectionViewUrl":"http://itunes.apple.com/jp/album/aint-no-sunshine/id14908862?i=14908889&uo=4", "trackViewUrl":"http://itunes.apple.com/jp/album/aint-no-sunshine/id14908862?i=14908889&uo=4", "previewUrl":"http://a1221.phobos.apple.com/us/r30/Music/77/cc/4e/mzi.wmtnxrdl.aac.p.m4p", "artworkUrl60":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.100x100-75.jpg", "collectionPrice":1050.00000, "trackPrice":150.00000, "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "discCount":1, "discNumber":1, "trackCount":21, "trackNumber":9, "trackTimeMillis":252800, "country":"JPN", "currency":"JPY", "primaryGenreName":"R&B/Soul"}, 
{"wrapperType":"track", "kind":"song", "artistId":32940, "collectionId":14908862, "trackId":14908886, "artistName":"Michael Jackson", "collectionName":"The Very Best of Michael Jackson With the Jackson 5", "trackName":"Rockin' Robin", "collectionCensoredName":"The Very Best of Michael Jackson With the Jackson 5", "trackCensoredName":"Rockin' Robin", "artistViewUrl":"http://itunes.apple.com/jp/artist/michael-jackson/id32940?uo=4", "collectionViewUrl":"http://itunes.apple.com/jp/album/rockin-robin/id14908862?i=14908886&uo=4", "trackViewUrl":"http://itunes.apple.com/jp/album/rockin-robin/id14908862?i=14908886&uo=4", "previewUrl":"http://a448.phobos.apple.com/us/r30/Music/e7/f4/12/mzi.otyhktrs.aac.p.m4p", "artworkUrl60":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.60x60-50.jpg", "artworkUrl100":"http://a1.phobos.apple.com/us/r2000/013/Features/ab/4b/d8/dj.dmlvbjtv.100x100-75.jpg", "collectionPrice":1050.00000, "trackPrice":150.00000, "collectionExplicitness":"notExplicit", "trackExplicitness":"notExplicit", "discCount":1, "discNumber":1, "trackCount":21, "trackNumber":8, "trackTimeMillis":154107, "country":"JPN", "currency":"JPY", "primaryGenreName":"R&B/Soul"}]
}

これが検索結果のJSONデータになります。
iphoneなどで利用する場合は、このJSONデータをパースする必要があります。
JSONデータのパースは、iphoneであればそこまで難しくはありませんが、今回はここまで。

まだまだ手探り状態なので、間違っている所があればアドバイスいただけると助かります。