API Documentation

Did you know that WP Tally has an API? Well we do! If you want to use our API to embed tally data in an app, on your website… or wherever, feel free! Read on for details on how to implement the WP Tally API in your project!

Accessing the API

The WP Tally API is designed with ease of use in mind. It only requires one parameter! Our API endpoint is accessible at http://wptally.com/api and can be utilized as shown below.

$args = array(
    'timeout' => 5
);

$wptally = wp_remote_get( 'http://wptally.com/api/mordauk', $args );
$data = wp_remote_retrieve_body( &$wptally );

By default, this will return a JSON object containing an array of the users plugins and themes, and relevant data as well as an info array containing the total download count and number of both. However, we recognize that some users may prefer working with XML, so the data can be returned in XML format by adding &format=xml to the query string!

We think the API is fairly straightforward, but just for the sake of completeness, the following is a sample (truncated) API return.

{
    "plugins": {
        "easy-digital-downloads": {
            "name": "Easy Digital Downloads",
            "url": "http:\/\/wordpress.org\/plugins\/easy-digital-downloads",
            "version": "2.1.5",
            "added": "10 Apr, 2012",
            "updated": "09 Oct, 2014",
            "rating": 4.8,
            "downloads": 403967
        },
        "restrict-content-pro-csv-user-import": {
            "name": "Restrict Content Pro - CSV User Import",
            "url": "http:\/\/wordpress.org\/plugins\/restrict-content-pro-csv-user-import",
            "version": "1.1.1",
            "added": "03 Sep, 2012",
            "updated": "02 Oct, 2014",
            "rating": 5,
            "downloads": 1702
        },
        "restrict-content-pro-bbpress": {
            "name": "Restrict Content Pro - bbPress",
            "url": "http:\/\/wordpress.org\/plugins\/restrict-content-pro-bbpress",
            "version": "0.5",
            "added": "05 Jul, 2012",
            "updated": "25 Sep, 2014",
            "rating": 4.8,
            "downloads": 1908
        },
        ...
    },
    "info": {
        "user": "mordauk",
        "profile": "https:\/\/profiles.wordpress.org\/mordauk",
        "plugin_count": 57,
        "total_plugin_downloads": 1293643
    }
}

Sorting API Data

The API accepts two parameters for sorting: order-by and sort. The order-by parameter can be set to one of two things, name or downloads. If not specified, the API assumes order-by=name. The sort parameter determines which direction to sort and accepts asc and desc.