Home     API一覧     楽天ブックスジャンル検索API

2013年7月、API名称「楽天ブックスジャンル検索API2」は「楽天ブックスジャンル検索API」に変更されました

楽天ブックスジャンル検索APIは楽天ブックスのジャンル名・ジャンル構造を返すAPIです。デベロッパーはジャンルIDを指定することでこれらの情報を得ることができます。

リクエストURL(REST/JSON形式の場合)


https://app.rakuten.co.jp/services/api/BooksGenre/Search/20121128?[parameter]=[value]…

※JSONP形式は、JSON形式で入力パラメーターにcallBackを指定することで出力されます。

たとえば、第一階層目のジャンル一覧を取得したい場合のリクエストURLは下記になります。(実際には改行せずに1行につなげてリクエストしてください。)

https://app.rakuten.co.jp/services/api/BooksGenre/Search/20121128?
        applicationId=[アプリID]
        &booksGenreId=000

※短い時間の間に大量に、同一のリクエストURLへアクセスすると、一定時間利用できなくなる場合がございます。テストの際にはご注意ください。

入力パラメーター


楽天ブックスジャンル検索API 入力パラメータ version:2012-11-28
ID 項目名 パラメーター 型(括弧内は最大バイト数) 必須 デフォルト 備考
Division: Shared parameters
1 App ID applicationId String 必須 - Check here
2 Affiliate ID affiliateId String - - Check here
3 Response format format String - json Either JSON or XML
When JSON is specified the callback parameter can also be set in order to use JSONP.
4 Callback function name callback String - - Function name to be used with the JSONP output
(UTF-8 URL encoded string)
Alphanumeric characters, periods, or underscores
5 Choosing output fields elements String - - By default, API response all of the fields. You can change response fields by this parameter.
This parameter's data is separated by comma(,).
For example, following request will response only itemName, itemPrice and itemUrl.
elements=itemName,itemPrice,itemUrl
6 Format version formatVersion int - 1

Response format version.

If formatVersion=2 is set, the response format (JSON) will be improved.

In case of formatVersion=1 :
Our API response will be returned in Array format as the followings.
You would need to use notation items[0].item.itemName To access itemName parameter.

{"items": [
    {"item": {
        "itemName": "a",
        "itemPrice": 10
    }},
    {"item": {
        "itemName": "b",
        "itemPrice": 20
    }}
]}

In case of formatVersion=2 :
Our API response will be returned in Array format as the followings.
You can use notation items[0].itemName To access itemName parameter.

{"items": [
    {
        "itemName": "a",
        "itemPrice": 10
    },
    {
        "itemName": "b",
        "itemPrice": 20
    }
]}
区分:サービス固有パラメーター
1 楽天ブックスジャンルID booksGenreId String Affiliate対応あり - ジャンルルートは、booksGenreId=000とする
2 ジャンルパス genrePath int(1) - 0 結果セットに祖先ジャンル(親ジャンルよりも上のジャンル)を含めるか否 か
0:含めない
1:含める

出力パラメーター


楽天ブックスジャンル検索API 出力パラメーター version:2012-11-28
ID 分類 項目名 パラメーター 備考
区分:サービス固有パラメーター
1 親ジャンル - parents 入力したジャンルIDの親ジャンル
「genrePath=1」を入力パラメータで指定し、指定したgenreIdよりも更に上位階層がある場合、"<parents>~ </parents>"内に複数の"<parent>~ </parent>"が表示される
2 楽天ブックスジャンルID booksGenreId ジャンルID
3 楽天ブックスジャンル名 booksGenreName ジャンル名
4 ジャンル階層 genreLevel ジャンル階層
ジャンルルートは000
5 自ジャンル - current ユーザの入力したジャンルID
6 楽天ブックスジャンルID booksGenreId ジャンルID
7 楽天ブックスジャンル名 booksGenreName ジャンル名
8 ジャンル階層 genreLevel ジャンル階層
9 子ジャンル - children ユーザの入力したジャンルIDの子ジャンル
複数の子ジャンルがある場合は"<children>~ </children>"内に複数の"<child>~ </child>"が複数生成される
入力が「booksGenreId=000」の時はgenreLevel=1のジャンルが"<children>~ </children>"内に複数の"<child>~ </child>"に表示される
10 楽天ブックスジャンルID booksGenreId ジャンルID
11 楽天ブックスジャンル名 booksGenreName ジャンル名
12 ジャンル階層 genreLevel ジャンル階層

Error

Error messages are displayed in the form of HTTP status code and its response body

HTTP Status Code Description Response body example (JSON)
400 Parameter error (or required parameters were insufficient)

If applicationId is not set

{
    "error": "wrong_parameter",
    "error_description": "specify valid applicationId"
}

If keyword is not valid (only 1 character given, etc.)

{
    "error": "wrong_parameter",
    "error_description": "keyword parameter is not valid"
}
404 If data not found.
{
    "error": "not_found",
    "error_description": "not found"
}
429 Too many requests

This error will be displayed if the number of API requests has been exceeded.
Please try access again after an amount of time.

{
    "error": "too_many_requests",
    "error_description": "number of allowed requests has been exceeded for this API. please try again soon."
}
500 Internal error in Rakuten Web Service

An internal system error occured. If you continue seeing this message for a long period, please give your inquiry via this link

{
    "error": "system_error",
    "error_description": "api logic error"
}
503 Unavailable due to maintenance or overloaded

Maintenance (the API name will be displayed in XXX/XXX)

{
    "error": "service_unavailable",
    "error_description": "XXX/XXX is under maintenance"
}

Response body format is display in format.

format Error output example
json
{
    "error": "wrong_parameter",
    "error_description": "page must be a number"
}
xml
<?xml version="1.0" encoding="UTF-8"?>
<root>
    <error>wrong_parameter</error>
    <error_description>page must be a number</error_description>
</root>