カテゴリID取得

カテゴリID取得はYahoo!ショッピングのカテゴリ名・カテゴリ構造をリアルタイムで返すAPIです。デベロッパーはカテゴリIDを指定することでこれらの情報を得ることができます。

変更履歴

2022年03月22日

・リクエストURLの情報を修正しました。
 修正前:JSONP
 修正後:JSON/JSONP
・リクエストパラメータ「output」「callback」の「説明」を修正しました。

2021年09月28日

「PHPSERIALIZE」による提供は終了しました。
https://shopping.yahooapis.jp/ShoppingWebService/V1/php/itemLookup
詳細はこちら

リクエストURL

XML
https://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch
JSON/JSONP
https://shopping.yahooapis.jp/ShoppingWebService/V1/json/categorySearch

リクエストパラメータ

Web APIの使い方#GETとは」をご参照ください。

パラメータ 説明
appid(必須) string Client ID(アプリケーションID)。詳細はこちらをご覧ください。
output xml(デフォルト)/php/json/jsonp/ レスポンス形式の指定
XMLのリクエストURL(shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch)のみ使用可能で、 このパラメータを指定すると各形式でのレスポンスを返すことができます。
未指定, xml:XML形式
json, jsonp:JSON形式
affiliate_type vc バリューコマースアフィリエイト(vc)を選択。
例:affiliate_type=vc
affiliate_id string バリューコマースアフィリエイトIDを入力。
callback string JSONPとして出力する際のコールバック関数名を入力する為のパラメータ。UTF-8でエンコードした文字列を入力する。
例:以下いずれの場合もJSONPで返します。
https://shopping.yahooapis.jp/ShoppingWebService/V1/json/categorySearch?callback=xxxxx
https://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch?output=json&callback=xxxxx
https://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch?output=jsonp&callback=xxxxx
category_id(必須) integer カテゴリIDを指定。
category_id=1のときルートカテゴリを返す(第1階層)

サンプルリクエストURL

https://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch?appid=<あなたのClient ID(アプリケーションID)>&category_id=1

レスポンスフィールド

カテゴリID取得APIのスキーマの記述は、以下になります。

フィールド 説明
/ResultSet/Result/Categories/Current/Id カテゴリID(現在)
/ResultSet/Result/Categories/Current/ParentId 親カテゴリID
/ResultSet/Result/Categories/Current/Url カテゴリページURL
/ResultSet/Result/Categories/Current/Title/Short カテゴリ名(現在)
/ResultSet/Result/Categories/Current/Title/Medium カテゴリパス名1
/ResultSet/Result/Categories/Current/Title/Long カテゴリパス名2
/ResultsSet/Result/Categories/Current/Path/Category カテゴリ情報です。(パス構造)

  • depth: トップからのカテゴリの深さ

/ResultsSet/Result/Categories/Current/Path/Category/Id カテゴリID(パス構造)
/ResultsSet/Result/Categories/Current/Path/Category/ParentId 親カテゴリID(パス構造)
/ResultsSet/Result/Categories/Current/Path/Category/Title/Name カテゴリ名(パス構造)
/ResultsSet/Result/Categories/Children/Child カテゴリ情報です。(子カテゴリ)

  • sortOrder: ソート順

/ResultsSet/Result/Categories/Children/Child/Id 子カテゴリID
/ResultSet/Result/Categories/Children/Child/Url 子カテゴリページUrl
/ResultSet/Result/Categories/Children/Child/Title/Short 子カテゴリ名
/ResultSet/Result/Categories/Children/Child/Title/Medium 子カテゴリパス名1
/ResultSet/Result/Categories/Children/Child/Title/Long 子カテゴリパス名2

サンプルレスポンス

以下は、Yahoo!ショッピング第1階層目のカテゴリ情報のリクエストに対するレスポンスです。

<?xml version="1.0" encoding="UTF-8"?>
<ResultSet xsi:schemaLocation="urn:yahoo:jp:categorySearch http://shopping.yahooapis.jp/ShoppingWebService/V1/categorySearch.xsd" xmlns="urn:yahoo:jp:categorySearch" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" totalResultsReturned="1">
<Result>
 <Categories>
   <Current>
     <Id>1</Id>
     <ParentId>0</ParentId>
     <Url/>
     <Title>
       <Short>Shopping</Short>
       <Medium/>
       <Long/>
     </Title>
     <Path>
       <Category depth="1">
         <Id>1</Id>
         <ParentId>0</ParentId>
         <Title>
           <Name>Shopping</Name>
         </Title>
       </Category>
     </Path>
   </Current>
   <Children>
     <Child sortOrder="0">
       <Id>13457</Id>
       <Url>http://shopping.yahoo.co.jp/category/13457/recommend</Url>
       <Title>
         <Short>ファッション</Short>
         <Medium>ファッション</Medium>
         <Long>ファッション</Long>
       </Title>
     </Child>
     <Child sortOrder="40">
       <Id>2498</Id>
       <Url>http://shopping.yahoo.co.jp/category/2498/recommend</Url>
       <Title>
         <Short>食品</Short>
         <Medium>食品</Medium>
         <Long>食品</Long>
       </Title>
     </Child>
     <Child sortOrder="60">
       <Id>2500</Id>
       <Url>http://shopping.yahoo.co.jp/category/2500/recommend</Url>
       <Title>
         <Short>ダイエット、健康</Short>
         <Medium>ダイエット、健康グッズ</Medium>
         <Long>ダイエット、健康</Long>
       </Title>
     </Child>
     <Child sortOrder="70">
       <Id>2501</Id>
       <Url>http://shopping.yahoo.co.jp/category/2501/recommend</Url>
       <Title>
         <Short>コスメ、香水</Short>
         <Medium>コスメ、香水</Medium>
         <Long>コスメ、香水</Long>
       </Title>
     </Child>
     <Child sortOrder="80">
       <Id>2502</Id>
       <Url>http://shopping.yahoo.co.jp/category/2502/recommend</Url>
       <Title>
         <Short>パソコン、周辺機器</Short>
         <Medium>パソコン、周辺機器</Medium>
         <Long>パソコン、周辺機器</Long>
       </Title>
     </Child>
     <Child sortOrder="90">
       <Id>2504</Id>
       <Url>http://shopping.yahoo.co.jp/category/2504/recommend</Url>
       <Title>
         <Short>AV機器、カメラ</Short>
         <Medium>AV機器、カメラ</Medium>
         <Long>AV機器、カメラ</Long>
       </Title>
     </Child>
     <Child sortOrder="100">
       <Id>2505</Id>
       <Url>http://shopping.yahoo.co.jp/category/2505/recommend</Url>
       <Title>
         <Short>家電</Short>
         <Medium>家電</Medium>
         <Long>家電</Long>
       </Title>
     </Child>
     <Child sortOrder="110">
       <Id>2506</Id>
       <Url>http://shopping.yahoo.co.jp/category/2506/recommend</Url>
       <Title>
         <Short>家具、インテリア</Short>
         <Medium>家具、インテリア用品</Medium>
         <Long>家具、インテリア</Long>
       </Title>
     </Child>
     <Child sortOrder="120">
       <Id>2507</Id>
       <Url>http://shopping.yahoo.co.jp/category/2507/recommend</Url>
       <Title>
         <Short>花、ガーデニング</Short>
         <Medium>花、ガーデニング用品</Medium>
         <Long>花、ガーデニング</Long>
       </Title>
     </Child>
     <Child sortOrder="130">
       <Id>2508</Id>
       <Url>http://shopping.yahoo.co.jp/category/2508/recommend</Url>
       <Title>
         <Short>キッチン、生活雑貨、日用品</Short>
         <Medium>キッチン、生活雑貨、日用品</Medium>
         <Long>キッチン、生活雑貨、日用品</Long>
       </Title>
     </Child>
     <Child sortOrder="140">
       <Id>2503</Id>
       <Url>http://shopping.yahoo.co.jp/category/2503/recommend</Url>
       <Title>
         <Short>DIY、工具、文具</Short>
         <Medium>DIY、工具、文具</Medium>
         <Long>DIY、工具、文具</Long>
       </Title>
     </Child>
     <Child sortOrder="150">
       <Id>2509</Id>
       <Url>http://shopping.yahoo.co.jp/category/2509/recommend</Url>
       <Title>
         <Short>ペット用品、生き物</Short>
         <Medium>ペット用品、生き物</Medium>
         <Long>ペット用品、生き物</Long>
       </Title>
     </Child>
     <Child sortOrder="160">
       <Id>2510</Id>
       <Url>http://shopping.yahoo.co.jp/category/2510/recommend</Url>
       <Title>
         <Short>楽器、趣味、学習</Short>
         <Medium>楽器、趣味、学習</Medium>
         <Long>楽器、趣味、学習</Long>
       </Title>
     </Child>
     <Child sortOrder="170">
       <Id>2511</Id>
       <Url>http://shopping.yahoo.co.jp/category/2511/recommend</Url>
       <Title>
         <Short>ゲーム、おもちゃ</Short>
         <Medium>ゲーム、おもちゃ</Medium>
         <Long>ゲーム、おもちゃ</Long>
       </Title>
     </Child>
     <Child sortOrder="180">
       <Id>2497</Id>
       <Url>http://shopping.yahoo.co.jp/category/2497/recommend</Url>
       <Title>
         <Short>ベビー、キッズ、マタニティ</Short>
         <Medium>ベビー、キッズ、マタニティ</Medium>
         <Long>ベビー、キッズ、マタニティ</Long>
       </Title>
     </Child>
     <Child sortOrder="190">
       <Id>2512</Id>
       <Url>http://shopping.yahoo.co.jp/category/2512/recommend</Url>
       <Title>
         <Short>スポーツ</Short>
         <Medium>スポーツ関連商品</Medium>
         <Long>スポーツ</Long>
       </Title>
     </Child>
     <Child sortOrder="200">
       <Id>2513</Id>
       <Url>http://shopping.yahoo.co.jp/category/2513/recommend</Url>
       <Title>
         <Short>レジャー、アウトドア</Short>
         <Medium>レジャー、アウトドア</Medium>
         <Long>レジャー、アウトドア</Long>
       </Title>
     </Child>
     <Child sortOrder="210">
       <Id>2514</Id>
       <Url>http://shopping.yahoo.co.jp/category/2514/recommend</Url>
       <Title>
         <Short>自転車、車、バイク</Short>
         <Medium>自転車、車、バイク</Medium>
         <Long>自転車、車、バイク</Long>
       </Title>
     </Child>
     <Child sortOrder="220">
       <Id>2516</Id>
       <Url>http://shopping.yahoo.co.jp/category/2516/recommend</Url>
       <Title>
         <Short>CD、音楽ソフト</Short>
         <Medium>CD、音楽ソフト</Medium>
         <Long>CD、音楽ソフト</Long>
       </Title>
     </Child>
     <Child sortOrder="230">
       <Id>2517</Id>
       <Url>http://shopping.yahoo.co.jp/category/2517/recommend</Url>
       <Title>
         <Short>DVD、映像ソフト</Short>
         <Medium>DVD、映像ソフト</Medium>
         <Long>DVD、映像ソフト</Long>
       </Title>
     </Child>
     <Child sortOrder="240">
       <Id>10002</Id>
       <Url>http://shopping.yahoo.co.jp/category/10002/recommend</Url>
       <Title>
         <Short>本、雑誌、コミック</Short>
         <Medium>本、雑誌、コミック</Medium>
         <Long>本、雑誌、コミック</Long>
       </Title>
     </Child>
   </Children>
 </Categories>
</Result>
</ResultSet>

エラー

カテゴリID取得はYahoo! JAPAN Web APIに共通のエラーメッセージおよびコードを返します。

利用制限

※短い時間の間に同一URLに大量にアクセスを行った場合、一定時間利用できなくなることもございます。(1クエリー/秒)

利用約款

このAPIに関する利用約款はこちら

アプリケーションの管理

目次

利用のルール

開発のヒント