API Reference – Easy Digital Downloads Documentation https://easydigitaldownloads.com Sell Digital Products With WordPress Mon, 13 Jan 2025 15:36:36 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.2 https://easydigitaldownloads.com/wp-content/uploads/2023/10/cropped-new-favicon-1-32x32.png API Reference – Easy Digital Downloads Documentation https://easydigitaldownloads.com 32 32 EDD REST API – Discounts https://easydigitaldownloads.com/docs/edd-rest-api-discounts/ Mon, 24 Jan 2022 19:58:20 +0000 https://edd-site.lndo.site/docs/edd-rest-api-discounts/ The EDD REST API provides the /discounts/ endpoint, which allows you to retrieve information about your the discounts that exist in your store. A basic discounts query looks like this: http://example.com/edd-api/discounts/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70 A sample discounts response looks like this: { "discounts": [ { "ID": 158, "name": "Taco Tuesday", "code": "TACOTUESDAY", "amount": 5, "min_price": 0, "type": "flat",

The post EDD REST API – Discounts first appeared on Easy Digital Downloads.

]]>
The
EDD REST API provides the /discounts/ endpoint, which allows you to retrieve information about your the discounts that exist in your store. A basic discounts query looks like this:

http://example.com/edd-api/discounts/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

A sample discounts response looks like this:

{
    "discounts": [
        {
            "ID": 158,
            "name": "Taco Tuesday",
            "code": "TACOTUESDAY",
            "amount": 5,
            "min_price": 0,
            "type": "flat",
            "uses": 0,
            "max_uses": 0,
            "start_date": "",
            "exp_date": "",
            "status": "inactive",
            "product_requirements": [
                114
            ],
            "requirement_condition": "all",
            "global_discount": false,
            "single_use": false
        },
        {
            "ID": 157,
            "name": "10% Off",
            "code": "10PERCENT",
            "amount": 10,
            "min_price": 0,
            "type": "percent",
            "uses": 0,
            "max_uses": 0,
            "start_date": "",
            "exp_date": "",
            "status": "active",
            "product_requirements": {
                "1": 68
            },
            "requirement_condition": "all",
            "global_discount": false,
            "single_use": false
        }
    ],
    "request_speed": 0.039878129959106
}

The post EDD REST API – Discounts first appeared on Easy Digital Downloads.

]]>
EDD REST API – Stats https://easydigitaldownloads.com/docs/edd-rest-api-stats/ Mon, 24 Jan 2022 19:57:49 +0000 https://edd-site.lndo.site/docs/edd-rest-api-stats/ The EDD REST API can return a great deal of statistical information about your store using the /stats/ endpoint. The stats query is used for retrieving earnings/sales stats from your store. It can be used to retrieve total earnings for the current month, last year, a specific date rage, etc, as well as the same

The post EDD REST API – Stats first appeared on Easy Digital Downloads.

]]>
The
EDD REST API can return a great deal of statistical information about your store using the /stats/ endpoint. The stats query is used for retrieving earnings/sales stats from your store. It can be used to retrieve total earnings for the current month, last year, a specific date rage, etc, as well as the same options for sales. It can also be used for retrieving earnings / sales stats for any or all products.

The stats endpoint is:

http://example.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=

Note that the
stats query requires a type parameter to be passed. There are two type options:

  • sales – For retrieving sale stats.
  • earnings – For retrieving earning stats.

Both
sales and earnings query types include additional parameters for date and product options:

  • date – The date to retrieve earnings or sales for. This has three accepted values:
    • today – Will retrieve stats for the current day.
    • yesterday – Will retrieve stats for the previous day.
    • range – Will retrieve stats for a date range.
      • startdate – Format: YYYYMMDD. Example: 20120224 = 2012/02/24
      • enddate – Format: YYYYMMDD. Example: 20120531 = 2012/02/24
  • product – used to retrieve sale or earnings stats for a specific product, or all products. This option has two accepted values:
    • # – The product ID to retrieve stats for.
    • all – Retrieve stats for all products. This option does not support paging.

Note: the product and date options cannot be combined. You may only use one or the other.

A basic earnings stats query looks like this:

http://example.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=earnings

And the response is:

{
    "earnings": {
        "current_month": 20,
        "last_month": 311.96,
        "totals": 1302.2764
    }
}

A basic sales stats query looks like this:

http://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales

And the response is:

{
    "sales": {
        "current_month": 1,
        "last_month": 18,
        "totals": 71
    }
}

If passing a date of
today or yesterday, the query looks like this:

http://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&date=today

And the response:

{
    "sales": {
        "today": 1
    }
}

If passing a date range, the query will be:

http://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&date=range&startdate=20130201&enddate=20130210

And the response:

{
    "totals": 12,
    "sales": {
        "20130201": 0,
        "20130202": 0,
        "20130203": 0,
        "20130204": 0,
        "20130205": 0,
        "20130206": 1,
        "20130207": 0,
        "20130208": 0,
        "20130209": 11,
        "20130210": 0
    }
}

Each item in the
sales object represents the day and the value is the amount.

If passing the
product parameter, like so

http://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&product=all

the response will be:

{
    "sales": [
        {
            "test-2": "6"
        },
        {
            "simple-notices-pro": "48"
        },
        {
            "love-it-pro": "13"
        },
        {
            "test-product-2-2": "0"
        },
        {
            "test-product-1-2": "0"
        }
    ]
}

Or for an individual product:

http://yoursite.com/edd-api/stats/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&type=sales&product=16

Response:

{
    "sales": [
        {
            "simple-notices-pro": "48"
        }
    ]
}

The post EDD REST API – Stats first appeared on Easy Digital Downloads.

]]>
EDD REST API – Customers https://easydigitaldownloads.com/docs/edd-rest-api-customers/ Mon, 24 Jan 2022 19:57:43 +0000 https://edd-site.lndo.site/docs/edd-rest-api-customers/ The EDD REST API provides an endpoint called /customers/. The customers endpoint allows for you to query the database and retrieve a list of customers that have purchased items from your shop. A basic customers query looks like this: http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&number=25 For each customer returned, the following information is returned for each customer: id – The

The post EDD REST API – Customers first appeared on Easy Digital Downloads.

]]>
The
EDD REST API provides an endpoint called /customers/. The customers endpoint allows for you to query the database and retrieve a list of customers that have purchased items from your shop. A basic customers query looks like this:

http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&number=25

For each customer returned, the following information is returned for each customer:

  • id – The WordPress user ID. If the customer purchased as a guest, this will return as -1.
  • username – The WordPress user login name. If the customer purchased as a guest, this will return as nothing.
  • display_name – The WordPress user display name. If the customer purchased as a guest, this will return as nothing.
  • first_name – The customer first name.
  • last_name – The customer last name.
  • email – The customer’s email address.
  • total_purchases – The total number of purchases the customer has made.
  • total_spent – The total amount the customer has spent.
  • total_downloads – The total number of files the customer has downloaded.

Along with the data returned for each customer is a
stats object that shows the total number of customers in the database.

A customers query response looks like this:

{
    "customers": [
        {
            "info": {
                "id": -1,
                "username": "Guest",
                "display_name": "Guest",
                "first_name": "Guest",
                "last_name": "Guest",
                "email": "johnson@test.com"
            },
            "stats": {
                "total_purchases": 2,
                "total_spent": "20",
                "total_downloads": 0
            }
        },
        {
            "info": {
                "id": -1,
                "username": "Guest",
                "display_name": "Guest",
                "first_name": "Guest",
                "last_name": "Guest",
                "email": "asda@test.com"
            },
            "stats": {
                "total_purchases": 0,
                "total_spent": "0",
                "total_downloads": 0
            }
        }
    ]
}

If you wish to retrieve the info for a specific customer, you can add the
&customer={identifier} parameter, like this:

http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&customer=1

or

http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&customer=email@domain.com

The response for a single customer will be like this:

{
    "customers": [
        {
            "info": {
                "id": 1,
                "username": "pippin",
                "display_name": "Pippin Williamson",
                "first_name": "Pippin",
                "last_name": "Williamson",
                "email": "pippin@pippinsplugins.com"
            },
            "stats": {
                "total_purchases": 61,
                "total_spent": 1139.68,
                "total_downloads": 31
            }
        }
    ]
}

The post EDD REST API – Customers first appeared on Easy Digital Downloads.

]]>
EDD REST API – Versioning https://easydigitaldownloads.com/docs/edd-rest-api-versioning/ Mon, 24 Jan 2022 19:57:42 +0000 https://edd-site.lndo.site/docs/edd-rest-api-versioning/ Since v1.5, Easy Digital Downloads includes a complete RESTful API that allows store data to be retrieved remotely in either a jSON or XML format. The API includes methods for retrieving info about store products, store customers, store sales, and store earnings. EDD 2.4 introduces API Versioning to allow for adding new functionality while not

The post EDD REST API – Versioning first appeared on Easy Digital Downloads.

]]>
Since v1.5, Easy Digital Downloads includes a complete RESTful API that allows store data to be retrieved remotely in either a jSON or XML format. The API includes methods for retrieving info about store products, store customers, store sales, and store earnings.

EDD 2.4 introduces API Versioning to allow for adding new functionality while not breaking past functionality for those that need it.

There are two methods of specifying an API version.
First is adding /v{number}/ to your API URL like this:
Second is adding a constant to your wp-config.php file like this:
define( 'EDD_API_VERSION', 'v2' );
If neither of these methods is used the latest version of the API is always delivered simply by going to /edd-api/sales with the proper token and API key.

The post EDD REST API – Versioning first appeared on Easy Digital Downloads.

]]>
EDD REST API V2 – Customers https://easydigitaldownloads.com/docs/edd-rest-api-v2-customers/ Mon, 24 Jan 2022 19:57:25 +0000 https://edd-site.lndo.site/docs/edd-rest-api-v2-customers/ This document relates specifically to Version 2 of the EDD API. Documentation for Version 1 is here. The EDD REST API provides an endpoint called /customers/. The customers endpoint allows for you to query the database and retrieve a list of customers that have purchased items from your shop. A basic customers query looks like

The post EDD REST API V2 – Customers first appeared on Easy Digital Downloads.

]]>
This document relates specifically to Version 2 of the EDD API.
Documentation for Version 1 is here.

The
EDD REST API provides an endpoint called /customers/. The customers endpoint allows for you to query the database and retrieve a list of customers that have purchased items from your shop. A basic customers query looks like this:

http://yoursite.com/edd-api/v2/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&number=25

For each customer returned, the following information is returned for each customer:

  • customer_id – The unique ID of the customer. Matches id in this API result.
  • user_id – The WordPress user ID. If the customer purchased as a guest, this will return as nothing.
  • username – The WordPress user login name. If the customer purchased as a guest, this will return as nothing.
  • display_name – The WordPress user display name. If the customer purchased as a guest, this will return as nothing.
  • first_name – The customer first name.
  • last_name – The customer last name.
  • email – The customer’s email address.
  • date_created – The date this customer was created in EDD.
  • total_purchases – The total number of purchases the customer has made.
  • total_spent – The total amount the customer has spent.
  • total_downloads – The total number of files the customer has downloaded.
  • date – The date to retrieve cutomers for. This has three accepted values:
    • today – Will retrieve customers created on the current day.
    • yesterday – Will retrieve customers created on the previous day.
    • range – Will retrieve customers created within a date range.
      • startdate – Format: YYYYMMDD. Example: 20120224 = 2012/02/24
      • enddate – Format: YYYYMMDD. Example: 20120531 = 2012/02/24

Along with the data returned for each customer is a
stats object that shows the total number of customers in the database.

A customers query response looks like this:

{
    "customers": [
        {
            "info": {
                "id": "3",
                "user_id": "",
                "username": "",
                "display_name": "",
                "customer_id": "3",
                "first_name": "Matthew",
                "last_name": "Dixon",
                "email": "matthew@example.com",
		"additional_emails": [],
                "date_created": "2016-05-28 00:09:40"
            },
            "stats": {
                "total_purchases": "1",
                "total_spent": "20.000000",
                "total_downloads": 0
            }
        },
        {
            "info": {
                "id": "2",
                "user_id": "2",
                "username": "bob",
                "display_name": "bob",
                "customer_id": "2",
                "first_name": "",
                "last_name": "",
                "email": "bob@example.com",
                "additional_emails": [
                    "robert.joiner@example.com"
                ],
                "date_created": "2016-05-17 14:17:15"
            },
            "stats": {
                "total_purchases": "1",
                "total_spent": "0.000000",
                "total_downloads": 0
            }
        },
        {
            "info": {
                "id": "1",
                "user_id": "1",
                "username": "jose",
                "display_name": "Jose",
                "customer_id": "1",
                "first_name": "Jose",
                "last_name": "Espinoza",
                "email": "jose@example.com",
		"additional_emails": [],
                "date_created": "2016-05-17 14:08:57"
            },
            "stats": {
                "total_purchases": "6",
                "total_spent": "70.000000",
                "total_downloads": 2
            }
        }
    ],
    "request_speed": 0.0081720352172852
}

If you wish to retrieve the info for a specific customer, you can add the
&customer={identifier} parameter, like this:

http://yoursite.com/edd-api/v2/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&customer=1

or

http://yoursite.com/edd-api/v2/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&customer=jose@domain.com

The response for a single customer will be like this:

{
    "customers": [
        {
            "info": {
                "id": "1",
                "user_id": "1",
                "username": "jose",
                "display_name": "Jose",
                "customer_id": "1",
                "first_name": "Jose",
                "last_name": "Espinoza",
                "email": "jose@example.com",
		"additional_emails": [],
                "date_created": "2016-05-17 14:08:57"
            },
            "stats": {
                "total_purchases": "6",
                "total_spent": "70.000000",
                "total_downloads": 2
            }
        }
    ]
}

A query looking for customers created today would look like this:

http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&date=today

A date range would look like this:

http://yoursite.com/edd-api/customers/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&date=range&startdate=20130201&enddate=20130210

The post EDD REST API V2 – Customers first appeared on Easy Digital Downloads.

]]>
EDD REST API – Authentication https://easydigitaldownloads.com/docs/edd-rest-api-authentication/ Mon, 24 Jan 2022 19:57:24 +0000 https://edd-site.lndo.site/docs/edd-rest-api-authentication/ The EDD REST API may only be accessed by URL with appropriate authentication. This authentication is accomplished by passing an API key and token with the URL, via query parameters. Each user on the site has their own unique set of keys and tokens. These can be managed all in one place by Shop Manager

The post EDD REST API – Authentication first appeared on Easy Digital Downloads.

]]>
The EDD REST API may only be accessed by URL with appropriate authentication. This authentication is accomplished by passing an API key and token with the URL, via query parameters. Each user on the site has their own unique set of keys and tokens. These can be managed all in one place by Shop Manager under Downloads > Tools > API Keys:

They may also be managed by individual users in their WordPress profile pages:

Once you have an API key, you can begin utilizing the EDD API. Both the API key and the token need to be appended to the URL as query parameters, like so:

https://yoursite.com/edd-api/?key=XXXX&token=XXXX

As seen in the screenshot above, API keys may be revoked if needed. If this is done the user is presented with a checkbox option to generate new keys:

The post EDD REST API – Authentication first appeared on Easy Digital Downloads.

]]>
EDD REST API – Sales https://easydigitaldownloads.com/docs/edd-rest-api-sales/ Mon, 24 Jan 2022 19:57:23 +0000 https://edd-site.lndo.site/docs/edd-rest-api-sales/ The EDD REST API provides access to sales data via the /sales/ endpoint. The sales endpoint allows for you to query the database and retrieve information for recent sales. A basic sales query looks like this: http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70 Requests to the /sales/ endpoint accept the following parameters: key – The API key to authenticate the request

The post EDD REST API – Sales first appeared on Easy Digital Downloads.

]]>
The EDD REST API provides access to sales data via the /sales/ endpoint. The sales endpoint allows for you to query the database and retrieve information for recent sales. A basic sales query looks like this:

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

Requests to the /sales/ endpoint accept the following parameters:

  • key – The API key to authenticate the request (required).
  • token – The API token to authenticate the request (required).
  • number – The number of records to return (optional).
  • email – A search parameter to return only payments that match the given email (optional).
  • id – The ID number of a specific payment record (optional).
  • purchasekey – The purchase key for a specific payment record (optional).

For each sale returned, the following information will be available:

  • ID – The sale ID number.
  • key -The sale purchase key.
  • subtotal – The sale subtotal.
  • tax – The sales tax amount.
  • fees – Any arbitrary fees that were added to the sale.
  • total – The total sale amount.
  • gateway – The payment method, such as stripe or paypal, used to make the purchase.
  • email – The email address associated with the sale.
  • date – The date the sale was made.
  • discounts – List of discount codes used.
  • products – A list of products purchased. For each product:
    • id – The Product ID.
    • quantity – The cart quantity for the item.
    • name – The name of the product.
    • price – The price of the product (after any discounts).
    • price_name – The price option name that was purchased (if the product has variable prices).

An example sales query response looks like this:

{
    "sales": [
        {
            "ID": 123,
            "mode": "",
            "status": "publish",
            "transaction_id": 12323461261234,
            "key": "ca2aaaa2a9e9e5369b8280403431b6fd",
            "subtotal": 89,
            "tax": "0",
            "fees": null,
            "total": "8.009",
            "gateway": "manual",
            "customer_id": "2",
            "user_id": "0",
            "email": "jdoe@example.org",
            "date": "2021-09-29 13:47:41",
            "discounts": null,
            "products": [
                {
                    "id": 167,
                    "quantity": 1,
                    "name": "Stripe Pro Payment Gateway",
                    "price": 89,
                    "price_name": "Single Site"
                }
            ],
        },
        {
            "ID": 122,
            "mode": "",
            "status": "publish",
            "transaction_id": 12324621266234,
            "key": "7608c3f1b8f5e00b7f21add193ab7ced",
            "subtotal": 199,
            "tax": "0",
            "fees": null,
            "total": "199.00",
            "gateway": "manual",
            "customer_id": "2",
            "user_id": "0",
            "email": "jdoe@example.org",
            "date": "2021-09-29 13:30:59",
            "discounts": null,
            "products": [
                {
                    "id": 1245716,
                    "quantity": 1,
                    "name": "Extended Pass",
                    "price": 199,
                    "price_name": ""
                }
        }
    ]
}

You can narrow the results down by email by adding “&email=test@test.com”. Replace “test@test.com” with the actual user’s email address for whom you want to show sales.

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&email=test@test.com

Retrieving Specific Sale Records

To retrieve a specific sale record, you can include either the id or the purchasekey parameter in the request.

For example, to retrieve a sale by the purchase key, the request looks like this:

http://example.com/edd-api/sales/?key=&token=&purchasekey=

To retrieve a sale by the ID, the request looks like this:

http://example.com/edd-api/sales/?key=&token=&id=

Searching Sale Records

Passing the email parameter will result in the API returning all sale records that match the given email address.

http://example.com/edd-api/sales/?key=&token=&email=

The post EDD REST API – Sales first appeared on Easy Digital Downloads.

]]>
EDD REST API – Products https://easydigitaldownloads.com/docs/edd-rest-api-products/ Mon, 24 Jan 2022 19:57:21 +0000 https://edd-site.lndo.site/docs/edd-rest-api-products/ TheEDD 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 published products. Products are intended to be publicly available. A basic products query looks like this: http://example.com/edd-api/products/ A sample products response

The post EDD REST API – Products first appeared on Easy Digital Downloads.

]]>
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 published products. Products are intended to be publicly available.

A basic products query looks like this:

http://example.com/edd-api/products/

A sample products response looks like this:

{
    "products": [
        {
            "info": {
                "id": 435,
                "slug": "test-2",
                "title": "Test",
                "create_date": "2013-02-06 19:25:18",
                "modified_date": "2013-02-12 09:40:31",
                "status": "publish",
                "link": "http://localhost/wordpress/?post_type=download&p=435",
                "permalink": "http://localhost/wordpress/?p=435",
                "content": "Test",
                "thumbnail": "http://localhost/wordpress/wp-content/uploads/edd/2013/01/2649089468_abb2633bc6_o.jpg"
            },
            "stats": {
                "total": {
                    "sales": "6",
                    "earnings": "60"
                },
                "monthly_average": {
                    "sales": 6,
                    "earnings": 60
                }
            },
            "pricing": {
                "amount": "29000.00"
            },
            "files": [
                {
                    "name": "",
                    "file": "test",
                    "condition": "all"
                }
            ],
            "notes": ""
        },
        {
            "info": {
                "id": 16,
                "slug": "simple-notices-pro",
                "title": "Simple Notices Pro",
                "create_date": "2013-01-07 22:42:18",
                "modified_date": "2013-02-25 16:16:39",
                "status": "publish",
                "link": "http://localhost/wordpress/?post_type=download&p=16",
                "content": "Dapibus dignissim hac ac penatibus eros, quis diam augue! Nisi dapibus in ridiculus auctor ridiculus scelerisque turpis augue, vel turpis ac odio egestas urna, eros in augue amet, mus et? Nisi est tincidunt ultricies et montes, massa sit. Nec purus? Est cras arcu vut pid? In, dapibus urna porttitor pellentesque pellentesque scelerisque! Diam vel in, adipiscing, dictumst? Cursus vut nec? Cras amet nunc? Tortor vel. Tempor phasellus integer et, turpis nec in! Ut vel turpis, ac dictumst augue! Auctor vel ut, penatibus parturient aliquam, porttitor! Aliquet vut magna eu, ac, aliquam montes a vel, odio, dictumst nec enim vel, pulvinar. Mattis dignissim, urna lacus purus integer, eros vel! Augue dictumst, in arcu integer magna elementum ut. Pid a lacus ultrices.",
                "thumbnail": "http://localhost/wordpress/wp-content/uploads/2013/01/edd_product_support.png"
            },
            "stats": {
                "total": {
                    "sales": "47",
                    "earnings": "902.2"
                },
                "monthly_average": {
                    "sales": 47,
                    "earnings": 902.2
                }
            },
            "pricing": {
                "priceone": "20",
                "pricetwo": "30",
                "price3": "40.55"
            },
            "files": [
                {
                    "name": "Screenshot from 2013-01-09 16:21:43",
                    "file": "http://localhost/wordpress/wp-content/uploads/edd/2013/01/Screenshot-from-2013-01-09-162143.png",
                    "condition": "all"
                },
                {
                    "name": "Screenshot from 2013-01-14 09:37:41",
                    "file": "http://localhost/wordpress/wp-content/uploads/edd/2013/02/Screenshot-from-2013-01-14-093741.png",
                    "condition": "1"
                }
            ],
            "notes": "These are the product notes."
        }
    ]
}

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/products/?product=55

The post EDD REST API – Products first appeared on Easy Digital Downloads.

]]>
EDD REST API – Endpoints https://easydigitaldownloads.com/docs/edd-rest-api-endpoints/ Mon, 24 Jan 2022 19:57:19 +0000 https://edd-site.lndo.site/docs/edd-rest-api-endpoints/ The EDD REST API includes six endpoints for accessing information, each for performing a specific kind of request: stats – For retrieving earnings/sales stats specific dates, date ranges, and specific products. products – For retrieving info about store products. customers – For retrieving customer stats. sales – For retrieving recent sales and info about each sale (items purchased, buyer,

The post EDD REST API – Endpoints first appeared on Easy Digital Downloads.

]]>
The EDD REST API includes six endpoints for accessing information, each for performing a specific kind of request:

  • stats – For retrieving earnings/sales stats specific dates, date ranges, and specific products.
  • products – For retrieving info about store products.
  • customers – For retrieving customer stats.
  • sales – For retrieving recent sales and info about each sale (items purchased, buyer, amount, etc).
  • discounts – For retrieving info about all available discounts.
  • download-logs – For retrieving logs of file downloads.

The endpoints are used like so:

http://example.com/edd-api//

For example:

http://example.com/edd-api/sales/

When combined with the API key and token, the complete URL looks like this:

http://example.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

Visibility

All endpoints require the API key and token except for the products endpoint. This is because products are intended to be public at all times by default.

Response Format

The response given by the EDD API is available in two formats:

To specify the format returned (jSON will be used if none is specified), simply add the
format argument to the URL:

http://yoursite.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&format=xml

A sample JSON response looks like this:

{
    "sales": [
        {
            "ID": 611,
            "subtotal": "20",
            "tax": 0,
            "fees": false,
            "total": "20",
            "gateway": "manual",
            "email": "johntest23@test.com",
            "date": "2013-02-25 11:42:05",
            "products": [
                {
                    "name": "Simple Notices Pro",
                    "price": "20",
                    "price_name": "Price one"
                }
            ]
        }
    ]
}

A sample XML response (for the same query) looks like this:

  
    611
    20
    0
    false
    20
    manual
    johntest23@test.com
    2013-02-25 11:42:05
    
      Simple Notices Pro
      20
      Price one
    
  

Optional URL Variables

You can add additional URL variables in order to adjust the output that is given. Here are a few examples of ways you can do that.

  • Number: By default, the API will show 10 results per page, if that’s what you have set under your Reading settings in WordPress. But if you want to change that for a specific API call, you can add “&number=11” to the URL to get a different number of results per page. In this example, you would get 11 results.
  • Page: By default, the API will show page number 1 of the results. If you want to change that for a specific API call, you can add “&page=2” to the URL to get a different page of results.

The post EDD REST API – Endpoints first appeared on Easy Digital Downloads.

]]>
EDD REST API – File Downloads https://easydigitaldownloads.com/docs/edd-rest-api-file-downloads/ Mon, 24 Jan 2022 19:57:16 +0000 https://edd-site.lndo.site/docs/edd-rest-api-file-downloads/ The EDD REST API provides the /file-download-logs/ endpoint, which allows you to retrieve logs for a given site. A basic download-logs query looks like this: http://example.com/edd-api/file-download-logs/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70 A sample download-logs response looks like this: { "download_logs": [ { "ID": 257, "user_id": "1", "product_id": 68, "product_name": "Ebook: I am Pippin Williamson, and so can YOU.", "customer_id": "1",

The post EDD REST API – File Downloads first appeared on Easy Digital Downloads.

]]>
The
EDD REST API provides the /file-download-logs/ endpoint, which allows you to retrieve logs for a given site. A basic download-logs query looks like this:

http://example.com/edd-api/file-download-logs/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70

A sample download-logs response looks like this:

{
    "download_logs": [
        {
            "ID": 257,
            "user_id": "1",
            "product_id": 68,
            "product_name": "Ebook: I am Pippin Williamson, and so can YOU.",
            "customer_id": "1",
            "payment_id": "254",
            "file": "Be Kind To Your Web Footed Friends",
            "ip": "68.56.68.4",
            "date": "2015-11-03 18:36:05"
        },
        {
            "ID": 256,
            "user_id": "1",
            "product_id": 68,
            "product_name": "Ebook: I am Pippin Williamson, and so can YOU.",
            "customer_id": "1",
            "payment_id": "254",
            "file": "Be Kind To Your Web Footed Friends",
            "ip": "68.56.68.4",
            "date": "2015-11-03 18:34:00"
        }
    ],
    "request_speed": 0.076191902160645
}
Download-logs Variables
customer

Appending &customer=user@example.com will narrow the log search to that email address. Example:

http://yoursite.com/edd-api/file-download-logs/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&customer=user@example.com

Error Messages

If the query you have passed to the EDD API returns an error, the response will come back like this:

{
    "error": "Invalid query!"
}

Each query method in the API includes meaningful error messages to help you figure out what you have done wrong.

For example, if you attempt to perform a stats query with a date range but enter an end date that is before the start date, you will get an error like this:

{
    "error": "The end date must be later than the date date!"
}

The post EDD REST API – File Downloads first appeared on Easy Digital Downloads.

]]>
EDD REST API V2 – Products https://easydigitaldownloads.com/docs/edd-rest-api-v2-products/ Mon, 24 Jan 2022 19:57:10 +0000 https://edd-site.lndo.site/docs/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.

The post EDD REST API V2 – Products first appeared on Easy Digital Downloads.

]]>
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

The post EDD REST API V2 – Products first appeared on Easy Digital Downloads.

]]>
EDD REST API – Introduction https://easydigitaldownloads.com/docs/edd-rest-api-introduction/ Mon, 24 Jan 2022 19:57:00 +0000 https://edd-site.lndo.site/docs/edd-rest-api-introduction/ Easy Digital Downloads includes a complete RESTful API that allows stored data to be retrieved remotely in either a JSON or XML format. The API includes methods for retrieving info about store products, store customers, store sales, and store earnings. Note: EDD’s REST API can only retrieve stored data, it cannot create Downloads/Products, Orders, or

The post EDD REST API – Introduction first appeared on Easy Digital Downloads.

]]>
Easy Digital Downloads includes a complete RESTful API that allows stored data to be retrieved remotely in either a JSON or XML format. The API includes methods for retrieving info about store products, store customers, store sales, and store earnings.

Note: EDD’s REST API can only retrieve stored data, it cannot create Downloads/Products, Orders, or Customers.

The API is accessed via the  edd-api end point of your store, like so:

https://yoursite.com/edd-api/

NOTE: If you are getting a 404 error when visiting the link above, you may need to re-save your permalinks. Do this by going to Dashboard > Settings > Permalinks > Save.

To access the API, you will need to provide a valid public API key and also a valid token. An API key and token can be generated for any user by going to  Downloads → Tools → API Keys:

The secret key is used for internal authentication and should never be used directly to access the API.

Individual users may go to their own profile and find their own key:

Once you have an API key, you can begin utilizing the EDD API. Both the API key and the token need to be appended to the URL as query parameters, like so:

https://yoursite.com/edd-api/?key=XXX&token=XXX

Paging Parameters

By default, the EDD API will return 10 results per page for the customers, sales, and products queries.

If a query has 20 results, the first ten will be displayed by default, but then the second 10 can be accessed by adding  &page=2 to the query string, like so:

https://yoursite.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&page=2

You can change the number of results returned by using the number parameter. This example will return 25 results per page:

https://yoursite.com/edd-api/sales/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&number=25

If you want to retrieve all results (no paging), set number to -1.

FAQ

Can you create orders, products, or customers via API?
No, you cannot create via the API. Our REST API currently only supports pulling data from your store.

The post EDD REST API – Introduction first appeared on Easy Digital Downloads.

]]>