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",
"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 &[email protected] 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!"
}