Reviews - REST API

Reviews integrates with the EDD REST API allowing you to retrieve reviews in either a JSON or XML format.

The  EDD REST API provides an endpoint called /reviews/. The reviews endpoint allows for you to query the database and retrieve a list of reviews placed on all products form your shop. A basic reviews query looks like this:

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

For each review returned, the following information is returned:

  • id - The unique ID of the review
  • title - The title of the review
  • parent - If the review is a reply, this gives the ID of the parent review
  • download_id - The ID of the download for which this review was created
  • download_title - Title of the download for which this review was created
  • rating - The rating given by the reviewer. This will be null for a reply.
  • author - The name of the author of the review
  • email - The email address of the author of the review
  • IP - The IP address from which the review was submitted
  • date - The date the review was submitted
  • date_gmt - The date (in GMT) the review was submitted
  • content - The content of the review
  • status - The status of the review. 1 represented approved and 0 represents unapproved (pending). The status can also be "spam" or "trash"
  • user_id - The WordPress user ID of the review author
  • type - Either a review or reply depending on what it is
  • votes - The amount of people that have voted that this review is helpful or unhelpful. This will be null for a reply. If this is a review, it will have sub-keys of yes and no

A reviews query response looks like this:

{
    "reviews": {
        "total": "2",
        "most_recent": [
            {
                "id": "63",
                "title": null,
                "parent": "60",
                "download_id": "1568",
                "download_title": "Endless Possibilities",
                "rating": null,
                "author": "Sunny Ratilal",
                "email": "dev@local.dev",
                "IP": "172.17.0.1",
                "date": "2016-07-20 17:24:48",
                "date_gmt": "2016-07-20 17:24:48",
                "content": "Replying to test review",
                "status": "1",
                "user_id": "1",
                "type": "reply",
                "votes": null
            },
            {
                "id": "61",
                "title": "Great read",
                "parent": "0",
                "download_id": "1566",
                "download_title": "eBook",
                "rating": "4",
                "author": "Sunny Ratilal",
                "email": "dev@local.dev",
                "IP": "172.17.0.1",
                "date": "2016-07-19 19:25:22",
                "date_gmt": "2016-07-19 19:25:22",
                "content": "Well written book",
                "status": "1",
                "user_id": "1",
                "type": "review",
                "votes": {
                    "yes": "3",
                    "no": "0"
                }
            },
        ]
    },
    "request_speed": 0.08372688293457
}

Certain query variables can be attached to the base query.  If you wish to receive just the data for a single review, you can add the  &review_id={identifier} parameter, like this:

http://yoursite.com/edd-api/reviews/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&review_id=61

The response for a single review looks like this:

{
    "reviews": {
        "id": "61",
        "title": "Great read",
        "parent": "0",
        "download_id": "1566",
        "download_title": "eBook",
        "rating": "4",
        "author": "Sunny Ratilal",
        "email": "dev@local.dev",
        "IP": "172.17.0.1",
        "date": "2016-07-19 19:25:22",
        "date_gmt": "2016-07-19 19:25:22",
        "content": "Well written book",
        "status": "1",
        "user_id": "1"
    },
    "request_speed": 0.0022079944610596
}

If you wish to receive all the reviews for a single download, you can add the  &download_id={identifier} parameter, like this:

http://yoursite.com/edd-api/reviews/?key=c281cf0a95be875d9eeb284fb004c938&token=5f9432f3ffa5945755ebc66179810d70&download_id=1568

The above query will generate a response similar to above but will have multiple sub-keys under the reviews key