EDD REST API V2 – Products
This document relates specifically to Version 2 of the EDD API.
Documentation for Version 1 is here.
The
EDD REST API provides access to product information via the /products/
endpoint. You may access multiple products or a single product.
NOTE: The products endpoint does not need a key or token to render publicly available products. If your product is publicly available on the front of your site, it’s available via API without a key or token.
A basic products query looks like this:
http://example.com/edd-api/v2/products/
A sample products response looks like this,
notes below:
{ "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": "http://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": "http://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": "http://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": "http://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": "http://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": "http://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 }
If SKUs are turned on, but the field is empty, it will render a hyphen, as in the second product in the example above.
Filtering Products
Specific Products
If you want to retrieve info for only a specific product, you can pass a product ID via the
product parameter:
http://example.com/edd-api/v2/products/?product=55
Searching
If you want to search for a product you can pass a search phrase via the
s
paramenter:
http://example.com/edd-api/v2/products/?s=PDF
Tags and Categories
You may narrow your search using the keywords category and tag, followed by either a slug or ID. Some examples:
http://example.com/edd-api/v2/products/?category=ebooks
http://example.com/edd-api/v2/products/?category=3
http://example.com/edd-api/v2/products/?tag=pdf
http://example.com/edd-api/v2/products/?tag=42
Combined example:
http://example.com/edd-api/v2/products/?category=ebooks&tag=pdf