iTunes Store Web Service Search API を使ってアプリ情報を取得する

iTunes Store Web Service Search API という API が Apple から公開されています。

これを使うと、iTunes Store で取り扱われているすべてのアイテム(ミュージック、映画、Podcast、アプリ)を検索することができるのですが、Apple が提供しているドキュメントの記述はちょっと古く、実際の iTunes Store のラインナップに追いついていません。(iPad アプリの検索方法が載っていなかったり。)

というわけで、いろいろ調べてみました。

iTunes Store Web Service Search API の基本

検索用の API の URL は以下のとおりです。

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?[parameters]

[parameters] に GET パラメータを指定します。必須のパラメータは

  • term:検索ワード
  • country:iTunes Store の国(日本であれば「JP」)
  • callback:JSONP を使う場合のコールバック関数名。クロスドメインアクセスの際には必須。

となっています。

ドキュメントに載っていない、利用可能なパラメータの調べ方

以下のURLを叩くと、エラーメッセージとしてパラメーターの最新の仕様が返ってくるようです。entity と attribute を見ると、ドキュメントにはないものがたくさんあります。

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?attribute=unrecognized

なお、2011年1月19日現在では、以下のような値が返ってきます。

{
    "errorMessage": "Invalid key-value pair(s) in request: {attributeType = "unrecognized"; }", 
    "queryParameters": {
        "callback": "A javascript function to handle your search results", 
        "country": "ISO-2A country code", 
        "lang": "ISO-2A language code", 
        "limit": "The number of search results to return", 
        "media": {
            "all": {
                "attribute": [
                    "allArtistTerm", 
                    "completeTitle", 
                    "institutionTerm", 
                    "composerTerm", 
                    "iTunesUCourseTerm", 
                    "actorTerm", 
                    "tier", 
                    "mostRecentChildReleaseDate", 
                    "allITunesUTrackTerm", 
                    "songTerm", 
                    "narratorTerm", 
                    "ringtone", 
                    "matchName", 
                    "featureFilmTerm", 
                    "directorProducerName", 
                    "urlTerm", 
                    "allTitle", 
                    "genreIndex", 
                    "allTrackTerm", 
                    "flavor", 
                    "tvEpisodeTerm", 
                    "shortFilmArtistTerm", 
                    "ratingTerm", 
                    "allArtistNames", 
                    "closedCaption", 
                    "podcastMediaTypeTerm", 
                    "completePlaylistTitle", 
                    "languageTerm", 
                    "iMixTerm", 
                    "releaseYearTerm", 
                    "albumTerm", 
                    "genreTerm", 
                    "titleTerm", 
                    "movieTerm", 
                    "artistAndComposer", 
                    "playlistTerm", 
                    "ratingIndex", 
                    "releaseDate", 
                    "artistTerm", 
                    "keywordsTerm", 
                    "directorTerm", 
                    "producerTerm", 
                    "shortFilmTerm", 
                    "authorTerm", 
                    "movieBundleTerm", 
                    "tvSeasonTerm", 
                    "movieArtistTerm", 
                    "showTerm", 
                    "mixTerm", 
                    "softwareDeveloper", 
                    "actorNames", 
                    "showAndSeasonTerm", 
                    "allITunesUArtistTerm", 
                    "descriptionTerm"
                ], 
                "entity": [
                    "allArtist", 
                    "allTrack", 
                    "album", 
                    "movie", 
                    "tvSeason", 
                    "software", 
                    "iPadSoftware", 
                    "musicVideo", 
                    "mix", 
                    "audiobook", 
                    "ebook", 
                    "podcast", 
                    "allITunesUPlaylist", 
                    "song", 
                    "tvEpisode", 
                    "podcastEpisode", 
                    "allITunesUTrack"
                ]
            }, 
            "audiobook": {
                "attribute": [
                    "ratingIndex", 
                    "completeTitle", 
                    "genreTerm", 
                    "allTitle", 
                    "titleTerm", 
                    "genreIndex", 
                    "descriptionTerm", 
                    "allArtistNames", 
                    "narratorTerm", 
                    "authorTerm"
                ], 
                "entity": [
                    "audiobookAuthor", 
                    "audiobook"
                ]
            }, 
            "movie": {
                "attribute": [
                    "directorProducerName", 
                    "movieArtistTerm", 
                    "completeTitle", 
                    "genreTerm", 
                    "allTitle", 
                    "movieTerm", 
                    "genreIndex", 
                    "flavor", 
                    "actorTerm", 
                    "shortFilmArtistTerm", 
                    "actorNames", 
                    "ratingTerm", 
                    "closedCaption", 
                    "allArtistNames", 
                    "ratingIndex", 
                    "artistTerm", 
                    "directorTerm", 
                    "producerTerm", 
                    "descriptionTerm", 
                    "shortFilmTerm", 
                    "releaseYearTerm", 
                    "featureFilmTerm", 
                    "movieBundleTerm"
                ], 
                "entity": [
                    "movieArtist", 
                    "movie"
                ]
            }, 
            "music": {
                "attribute": [
                    "albumTerm", 
                    "mixTerm", 
                    "genreTerm", 
                    "completeTitle", 
                    "allTitle", 
                    "composerTerm", 
                    "genreIndex", 
                    "flavor", 
                    "tier", 
                    "musicTrackTerm", 
                    "artistAndComposer", 
                    "allArtistNames", 
                    "songTerm", 
                    "releaseDate", 
                    "ratingIndex", 
                    "artistTerm", 
                    "completePlaylistTitle", 
                    "ringtone", 
                    "iMixTerm", 
                    "matchName"
                ], 
                "entity": [
                    "musicArtist", 
                    "musicTrack", 
                    "album", 
                    "musicVideo", 
                    "mix", 
                    "song"
                ]
            }, 
            "musicVideo": {
                "attribute": [
                    "albumTerm", 
                    "genreTerm", 
                    "completeTitle", 
                    "allTitle", 
                    "genreIndex", 
                    "flavor", 
                    "allArtistNames", 
                    "songTerm", 
                    "ratingIndex", 
                    "artistTerm", 
                    "completePlaylistTitle", 
                    "ringtone", 
                    "matchName"
                ], 
                "entity": [
                    "musicVideoArtist", 
                    "musicVideo"
                ]
            }, 
            "podcast": {
                "attribute": [
                    "albumTerm", 
                    "urlTerm", 
                    "completeTitle", 
                    "genreTerm", 
                    "allTitle", 
                    "titleTerm", 
                    "genreIndex", 
                    "mostRecentChildReleaseDate", 
                    "allArtistNames", 
                    "playlistTerm", 
                    "ratingIndex", 
                    "podcastMediaTypeTerm", 
                    "completePlaylistTitle", 
                    "artistTerm", 
                    "languageTerm", 
                    "keywordsTerm", 
                    "descriptionTerm", 
                    "authorTerm"
                ], 
                "entity": [
                    "podcastAuthor", 
                    "podcast", 
                    "podcastEpisode"
                ]
            }, 
            "shortFilm": {
                "attribute": [
                    "genreTerm", 
                    "completeTitle", 
                    "allTitle", 
                    "genreIndex", 
                    "flavor", 
                    "shortFilmArtistTerm", 
                    "allArtistNames", 
                    "closedCaption", 
                    "ratingIndex", 
                    "artistTerm", 
                    "descriptionTerm", 
                    "shortFilmTerm", 
                    "releaseYearTerm"
                ], 
                "entity": [
                    "shortFilmArtist", 
                    "shortFilm"
                ]
            }, 
            "software": {
                "attribute": [
                    "gameCenterOnly", 
                    "mediaTypeTerm", 
                    "alternateTitleTerm", 
                    "completeTitle", 
                    "genreTerm", 
                    "allTitle", 
                    "genreIndex", 
                    "softwareDeveloper", 
                    "deviceTerm", 
                    "allArtistNames", 
                    "free", 
                    "ratingIndex", 
                    "softwareTerm", 
                    "releaseDate", 
                    "keywordsTerm", 
                    "descriptionTerm"
                ], 
                "entity": [
                    "softwareDeveloper", 
                    "software", 
                    "iPadSoftware"
                ]
            }, 
            "tvShow": {
                "attribute": [
                    "tvSeasonTerm", 
                    "showTerm", 
                    "genreTerm", 
                    "completeTitle", 
                    "allTitle", 
                    "genreIndex", 
                    "flavor", 
                    "tvEpisodeTerm", 
                    "allArtistNames", 
                    "showAndSeasonTerm", 
                    "ratingIndex", 
                    "completePlaylistTitle", 
                    "descriptionTerm"
                ], 
                "entity": [
                    "tvShow", 
                    "tvEpisode", 
                    "tvSeason"
                ]
            }
        }, 
        "offset": "The result index at which to start returning results", 
        "output": "json", 
        "term": "A search string"
    }
}

例:「リクルート」が提供する iPhone アプリを検索

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=リクルート&country=JP&entity=software&attribute=softwareDeveloper&limit=200
  • term:「リクルート」と指定
  • entity:「software」と指定
  • attribute:「softwareDeveloper」と指定

例:「リクルート」が提供する iPad アプリを検索

http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/wa/wsSearch?term=リクルート&country=JP&entity=iPadSoftware&attribute=softwareDeveloper&limit=200

entity=software だと iPhone アプリしかヒットしないのですが、entity=iPadSoftware とすることで、iPad アプリを検索することができました。

  • term:「リクルート」と指定
  • entity:「iPadSoftware」と指定
  • attribute:「softwareDeveloper」と指定

参考サイト

以下のサイトを参考にさせていただきました。

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

次のHTML タグと属性が使えます: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>