このドキュメントは、EDD APIのバージョン2にspecifically関連しています。
バージョン1のドキュメントはこちら。
/products/ エンドポイントを介して、製品情報へのアクセスを提供します。複数の製品または単一の製品にアクセスできます。
EDD REST API
注意: 製品エンドポイントは、公開されている製品をレンダリングするためにキーやトークンを必要としません。製品がサイトのフロントで公開されている場合、キーやトークンなしでAPI経由で利用できます。
基本的な製品クエリは次のようになります。
https://example.com/edd-api/v2/products/
製品の応答のサンプルは次のようになります。
注記:
{
"products": [
{
"info": {
"id": 45,
"slug": "pdf-test",
"title": "PDF Test",
"create_date": "2016-05-23 18:44:51",
"modified_date": "2016-06-08 17:30:54",
"status": "publish",
"link": "https://example.com/?post_type=download&p=45",
"content": "",
"excerpt": "",
"thumbnail": false,
"category": [
{
"term_id": 3,
"name": "ebooks",
"slug": "ebooks",
"term_group": 0,
"term_taxonomy_id": 3,
"taxonomy": "download_category",
"description": "",
"parent": 0,
"count": 2,
"filter": "raw",
"object_id": 45
}
],
"tags": [
{
"term_id": 7,
"name": "pdf",
"slug": "pdf",
"term_group": 0,
"term_taxonomy_id": 7,
"taxonomy": "download_tag",
"description": "",
"parent": 0,
"count": 1,
"filter": "raw",
"object_id": 45
}
],
"sku": "AAMAM2016"
},
"stats": {
"total": {
"sales": "0",
"earnings": "0.00"
},
"monthly_average": {
"sales": "0",
"earnings": "0.00"
}
},
"pricing": {
"amount": "1.00"
},
"files": [
{
"index": "0",
"attachment_id": "18",
"name": "WCCHI_2014_page_speed",
"file": "https://example.com/wp-content/uploads/edd/2016/05/WCCHI_2014_page_speed.pdf",
"condition": "all"
}
],
"notes": "",
"licensing": {
"enabled": false,
"version": "",
"exp_unit": "days",
"exp_length": ""
}
},
{
"info": {
"id": 42,
"slug": "variable-license",
"title": "Variable license",
"create_date": "2016-05-20 22:21:38",
"modified_date": "2016-05-23 17:32:47",
"status": "publish",
"link": "https://example.com/?post_type=download&p=42",
"content": "",
"excerpt": "",
"thumbnail": false,
"category": false,
"tags": false,
"sku": "-"
},
"stats": {
"total": {
"sales": "0",
"earnings": "0.00"
},
"monthly_average": {
"sales": "0",
"earnings": "0.00"
}
},
"pricing": {
"monthly": "10.00",
"yearly": "120.00"
},
"files": [
{
"index": "0",
"attachment_id": "18",
"name": "WCCHI_2014_page_speed",
"file": "https://example.com/wp-content/uploads/edd/2016/05/WCCHI_2014_page_speed.pdf",
"condition": "all"
}
],
"notes": "",
"licensing": {
"enabled": true,
"version": "",
"exp_unit": "days",
"exp_length": ""
}
},
{
"info": {
"id": 17,
"slug": "i-am-pippin-williamson-and-so-can-you",
"title": "I am Pippin Williamson, and so can YOU",
"create_date": "2016-05-17 14:03:50",
"modified_date": "2016-06-02 19:51:17",
"status": "publish",
"link": "https://example.com/?post_type=download&p=17",
"content": "This is a test",
"excerpt": "",
"thumbnail": false,
"category": [
{
"term_id": 3,
"name": "ebooks",
"slug": "ebooks",
"term_group": 0,
"term_taxonomy_id": 3,
"taxonomy": "download_category",
"description": "",
"parent": 0,
"count": 2,
"filter": "raw",
"object_id": 17
}
],
"tags": false,
"sku": "-"
},
"stats": {
"total": {
"sales": "4",
"earnings": "78.000000"
},
"monthly_average": {
"sales": "4",
"earnings": "78.000000"
}
},
"pricing": {
"amount": "20.00"
},
"files": [
{
"index": "0",
"attachment_id": "18",
"name": "WCCHI_2014_page_speed",
"file": "https://example.com/wp-content/uploads/edd/2016/05/WCCHI_2014_page_speed.pdf",
"condition": "all"
}
],
"notes": "This is my download note!",
"licensing": {
"enabled": false,
"version": "",
"exp_unit": "",
"exp_length": ""
}
},
],
"request_speed": 0.0075628757476807
}
SKUがオンになっているがフィールドが空の場合、上記の例の2番目の製品のようにハイフンが表示されます。
製品のフィルタリング
特定の製品
特定の製品の情報を取得したい場合は、
product パラメータを介して製品IDを渡すことができます。
https://example.com/edd-api/v2/products/?product=55
検索
製品を検索したい場合は、
s パラメータを介して検索フレーズを渡すことができます。
https://example.com/edd-api/v2/products/?s=PDF
タグとカテゴリ
カテゴリとタグのキーワード、それに続くスラッグまたはIDを使用して検索を絞り込むことができます。例をいくつか示します。
https://example.com/edd-api/v2/products/?category=ebooks
https://example.com/edd-api/v2/products/?category=3
https://example.com/edd-api/v2/products/?tag=pdf
https://example.com/edd-api/v2/products/?tag=42
複合例:
https://example.com/edd-api/v2/products/?category=ebooks&tag=pdf
