GET /insights/$slug

Get raw data for a particular graph.

Resource Information

   
Method GET
URL https://public-api.wordpress.com/rest/v1.1/insights/$slug
Requires authentication? Yes

Method Parameters

Parameter Type Description
$slug (string) Report slug (rest-api-calls, rest-api-writes, etc). If a slash is present, it must be urlencoded.

Query Parameters

Parameter Type Description
context (string)
display:
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
edit:
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser Javascript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma-separated list. Example: meta=site,likes
fields (string) Optional. Returns specified fields only. Comma-separated list. Example: fields=ID,title
callback (string) An optional JSONP callback function.
unit (string) By default, weekly stats are provided in the data array. You can also pass daily, monthly, or cumulative to get totals for different time periods.
after (int) Return data only since the specified UNIX time.
before (int) Return data collected on or before the specified UNIX time.

Response Parameters

Parameter Type Description
points (int) The number of datapoints returned.
data (array) Numbers of actions by timestamp.
summaries (array) Summary for the current day/week/month/year/decade, including % change.
started_tracking (string) The date stats began collecting.

Example

cURL

curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
 'https://public-api.wordpress.com/rest/v1/insights/rest-api-calls'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
    'header' => 
    array (
      0 => 'authorization: Bearer YOUR_API_TOKEN',
    ),
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
  'https://public-api.wordpress.com/rest/v1/insights/rest-api-calls',
  false,
  $context
);
$response = json_decode( $response );

?>

Example Response

{
    "points": 62,
    "data": {
        "Week of Feb 25, 2013": 6,
        "Week of Aug 05, 2013": 40,
        "Week of Feb 24, 2014": 12795,
        "Week of Mar 03, 2014": 13490,
        "Week of Mar 10, 2014": 13285,
        "Week of Mar 17, 2014": 13591,
        "Week of Mar 24, 2014": 14090,
        "Week of Mar 31, 2014": 13733,
        "Week of Apr 07, 2014": 22023,
        "Week of Apr 14, 2014": 24693,
        "Week of Apr 21, 2014": 26752,
        "Week of Apr 28, 2014": 25395,
        "Week of May 05, 2014": 25133,
        "Week of May 12, 2014": 24151,
        "Week of May 19, 2014": 26095,
        "Week of May 26, 2014": 24464,
        "Week of Jun 02, 2014": 25636,
        "Week of Jun 09, 2014": 23818,
        "Week of Jun 16, 2014": 24773,
        "Week of Jun 23, 2014": 26956,
        "Week of Jun 30, 2014": 31203,
        "Week of Jul 07, 2014": 30131,
        "Week of Jul 14, 2014": 28780,
        "Week of Jul 21, 2014": 28639,
        "Week of Jul 28, 2014": 30327,
        "Week of Aug 04, 2014": 32076,
        "Week of Aug 11, 2014": 30014,
        "Week of Aug 18, 2014": 30070,
        "Week of Aug 25, 2014": 32056,
        "Week of Sep 01, 2014": 33446,
        "Week of Sep 08, 2014": 34451,
        "Week of Sep 15, 2014": 33094,
        "Week of Sep 22, 2014": 32766,
        "Week of Sep 29, 2014": 33643,
        "Week of Oct 06, 2014": 34766,
        "Week of Oct 13, 2014": 40913,
        "Week of Oct 20, 2014": 35184,
        "Week of Oct 27, 2014": 50305,
        "Week of Nov 03, 2014": 52576,
        "Week of Nov 10, 2014": 45952,
        "Week of Nov 17, 2014": 52085,
        "Week of Nov 24, 2014": 56560,
        "Week of Dec 01, 2014": 53729,
        "Week of Dec 08, 2014": 53228,
        "Week of Dec 15, 2014": 52679,
        "Week of Dec 22, 2014": 51766,
        "Week of Dec 29, 2014": 51387,
        "Week of Jan 05, 2015": 53459,
        "Week of Jan 12, 2015": 52340,
        "Week of Jan 19, 2015": 52087,
        "Week of Jan 26, 2015": 53037,
        "Week of Feb 02, 2015": 52149,
        "Week of Feb 09, 2015": 35874,
        "Week of Feb 16, 2015": 31100,
        "Week of Feb 23, 2015": 34001,
        "Week of Mar 02, 2015": 27858,
        "Week of Mar 09, 2015": 16019,
        "Week of Mar 16, 2015": 16017,
        "Week of Mar 23, 2015": 15964,
        "Week of Mar 30, 2015": 15854,
        "Week of Apr 06, 2015": 15748,
        "Week of Apr 13, 2015": 16894
    },
    "summaries": {
        "last_24_hours": "2249",
        "percent_change_since_previous_24_hours": -28.6,
        "last_7_days": "16894",
        "percent_change_since_previous_7_days": 7.3,
        "last_31_days": "71298",
        "percent_change_since_previous_31_days": -37.3,
        "last_365_days": "1816495",
        "percent_change_since_previous_365_days": 1357.3
    },
    "started_tracking": "Feb 25, 2013"
}