印刷する

カテゴリー

categories > list

カテゴリー一覧をリクエストします。

リクエストの構築

リクエストURLとGET変数

リクエスト固有のGET変数

変数説明
gocategoriesAPIセクション
dolistAPIアクション

リクエストURLは以下のようになります。必須情報(key, timestamp, salt, signature)を追加することを忘れないでください。

https://....../api.php?go=categories&do=list&{required information}
POST変数

以下のリストフィルターはPOST変数を使って利用できます。フィルターは複数同時に使用可能です。

変数説明
includeData (int) 0|1 データフィールドを含めるかどうか。
0の場合、カテゴリIDとステータスを含むリストのみが返されます。
ページングオプション
resultsPerPageFilter (int) n 1ページあたりの結果の数(何件表示か)
current_page (int) n 現在のページ数(何ページ目か)
よく使われるフィルター
statusFilter(mixed) status 指定された状況と一致するカテゴリーをリストします。
利用可能な値:"any" (デフォルト), 0 (非アクティブ), 1 (アクティブ)
注:ハッシュなしのリクエストではアクティブなカテゴリーのみを返します。
sortByFilter (string) "option" リストを並べ替えます。
利用可能な値:"title" (デフォルト), "id", "order_title", "order_id"
parentFilter (mixed) parent 親IDからカテゴリーを一覧表示します。
すべてのカテゴリを一覧表示するには、"any"を指定します。
要求されたカテゴリーをそのすべての子カテゴリーと共にリストするには、"Category ID > 0"を指定してください。
maxLevel (int) 1-4 リストするカテゴリーの最大の入れ子レベル(最大値=4)。
検索フィルター
search (string) "term" 検索する用語。検索はカテゴリータイトルでのみ実行されます。

応答例

リクエストが成功した場合は、以下の内容のレスポンスを受け取ります。
list_total_found:(ページングの目的で)基準に一致した、見つかったアイテムの合計数。
list_total:返されたリストの項目数。これは通常"resultsPerPageFilter"の値と一致します。
list:アイテムリスト

{
    "list_total_found": 3,
    "list_total": 3,
    "list": [{
                "breadcrumb": [5],
                "children": [],
                "description": "Live events",
                "description_seo": "Live events",
                "id": 5,
                "id_parent": null,
                "img_icon": "http:\/\/......\/uploads\/images\/category_5_1364385573_icon.jpg",
                "img_poster": "http:\/\/......\/uploads\/images\/category_5_1364385573_poster.jpg",
                "img_social": "http:\/\/......\/uploads\/images\/category_5_1364385573_social.jpg",
                "img_thumbnail": "http:\/\/......\/uploads\/images\/category_5_1364385573_thumb.jpg",
                "level": 1,
                "status": "1",
                "tags": "",
                "title": "Live!",
                "title_url": "live!",
                "title_url_full": "live!",
                "url": "http:\/\/......\/index.php\/c\/5\/live!\/",
                "views_page": "102"
            }, {
                "breadcrumb": [1],
                "children": [6],
                "description": "Latest Movies",
                "description_seo": "Latest Movies",
                "id": 1,
                "id_parent": null,
                "img_icon": "http:\/\/......\/uploads\/images\/category_1_1364385555_icon.jpg",
                "img_poster": "http:\/\/......\/uploads\/images\/category_1_1364385555_poster.jpg",
                "img_social": "http:\/\/......\/uploads\/images\/category_1_1364385555_social.jpg",
                "img_thumbnail": "http:\/\/......\/uploads\/images\/category_1_1364385555_thumb.jpg",
                "level": 1,
                "status": "1",
                "tags": "",
                "title": "Movies",
                "title_url": "movies",
                "title_url_full": "movies",
                "url": "http:\/\/......\/index.php\/c\/1\/movies\/",
                "views_page": "2557"
            }, {
                "breadcrumb": ["1", 6],
                "children": [],
                "description": "Action Movies",
                "description_seo": "Action Movies",
                "id": 6,
                "id_parent": "1",
                "img_icon": "http:\/\/......\/uploads\/images\/category_6_1364385648_icon.jpg",
                "img_poster": "http:\/\/......\/uploads\/images\/category_6_1364385648_poster.jpg",
                "img_social": "http:\/\/......\/uploads\/images\/category_6_1364385648_social.jpg",
                "img_thumbnail": "http:\/\/......\/uploads\/images\/category_6_1364385648_thumb.jpg",
                "level": 2,
                "status": "1",
                "tags": "",
                "title": "Action",
                "title_url": "action",
                "title_url_full": "movies-action",
                "url": "http:\/\/......\/index.php\/c\/6\/movies-action\/",
                "views_page": "63"
            }]
}

認証情報にGETの許可がない場合など、リクエストが失敗した場合のレスポンス

{
	"error"		 : "REQUEST_ERROR",
	"error_long" : "Permission error: GET"
}

このリクエストは以下のエラーを返す可能性があります。

REQUEST_ERROR | No Categories were found
カテゴリーが見つかりません。

その他のエラー内容に関しては一般的なエラーメッセージを確認してください。

PHPサンプルコード

GETおよびPOSTデータを準備します。

// GET変数
$GET_VARS = array( 
					"go"        => "categories",
					"do"        => "list"
					);

// POST変数
$POST_VARS = array(
					"includeData"			=> 1, // 全てのデータフィールドを表示
					"maxLevel"				=> 4, // 全てのレベルを一覧表示
					"resultsPerPageFilter"	=> 3, // 1ページあたり3件の結果を返す
					"current_page"			=> 1, // ページ1に戻る
					"sortByFilter"			=> "title", // タイトル順に並べ替え
					"statusFilter"			=> 1  // アクティブなカテゴリーのみ表示
                    );