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.

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
404 not_found The stat does not exist
403 authorization_required This access token cannot view this insight information.
403 authorization_required An active access token with developer permissions for this app must be used to query insights information.

Example

curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
 'https://public-api.wordpress.com/rest/v1/insights/rest-api-calls'
<?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 );
?>

Response

{
    "points": 129,
    "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": 17651,
        "Week of Apr 20, 2015": 2377,
        "Week of Apr 27, 2015": 1249,
        "Week of May 04, 2015": 1378,
        "Week of May 11, 2015": 1459,
        "Week of May 18, 2015": 1456,
        "Week of May 25, 2015": 1462,
        "Week of Jun 01, 2015": 1471,
        "Week of Jun 08, 2015": 1467,
        "Week of Jun 15, 2015": 1463,
        "Week of Jun 22, 2015": 1472,
        "Week of Jun 29, 2015": 1453,
        "Week of Jul 06, 2015": 1453,
        "Week of Jul 13, 2015": 1636,
        "Week of Jul 20, 2015": 1722,
        "Week of Jul 27, 2015": 1606,
        "Week of Aug 03, 2015": 1686,
        "Week of Aug 10, 2015": 1649,
        "Week of Aug 17, 2015": 1462,
        "Week of Aug 24, 2015": 1225,
        "Week of Aug 31, 2015": 1496,
        "Week of Sep 07, 2015": 1614,
        "Week of Sep 14, 2015": 1621,
        "Week of Sep 21, 2015": 1664,
        "Week of Sep 28, 2015": 1683,
        "Week of Oct 05, 2015": 1797,
        "Week of Oct 12, 2015": 1785,
        "Week of Oct 19, 2015": 1785,
        "Week of Oct 26, 2015": 1685,
        "Week of Nov 02, 2015": 1757,
        "Week of Nov 09, 2015": 1791,
        "Week of Nov 16, 2015": 1819,
        "Week of Nov 23, 2015": 1955,
        "Week of Nov 30, 2015": 1976,
        "Week of Dec 07, 2015": 3759,
        "Week of Dec 14, 2015": 2203,
        "Week of Dec 21, 2015": 2017,
        "Week of Dec 28, 2015": 2003,
        "Week of Jan 04, 2016": 2016,
        "Week of Jan 11, 2016": 2024,
        "Week of Jan 18, 2016": 2016,
        "Week of Jan 25, 2016": 1456,
        "Week of Feb 01, 2016": 1889,
        "Week of Feb 08, 2016": 1965,
        "Week of Feb 15, 2016": 1836,
        "Week of Feb 22, 2016": 1846,
        "Week of Feb 29, 2016": 1851,
        "Week of Mar 07, 2016": 1884,
        "Week of Mar 14, 2016": 1867,
        "Week of Mar 21, 2016": 2085,
        "Week of Mar 28, 2016": 1836,
        "Week of Apr 04, 2016": 1842,
        "Week of Apr 11, 2016": 1869,
        "Week of Apr 18, 2016": 1876,
        "Week of Apr 25, 2016": 1876,
        "Week of May 02, 2016": 1878,
        "Week of May 09, 2016": 1870,
        "Week of May 16, 2016": 1882,
        "Week of May 23, 2016": 1875,
        "Week of May 30, 2016": 1874,
        "Week of Jun 06, 2016": 1435,
        "Week of Jun 13, 2016": 7050,
        "Week of Jun 20, 2016": 1393,
        "Week of Jun 27, 2016": 14638,
        "Week of Jul 04, 2016": 1616,
        "Week of Jul 11, 2016": 1619,
        "Week of Jul 18, 2016": 2335,
        "Week of Jul 25, 2016": 262
    },
    "summaries": {
        "last_24_hours": "31",
        "percent_change_since_previous_24_hours": -86.6,
        "last_7_days": "1329",
        "percent_change_since_previous_7_days": -45.2,
        "last_31_days": "20675",
        "percent_change_since_previous_31_days": 63.8,
        "last_365_days": "113570",
        "percent_change_since_previous_365_days": -92.2
    },
    "started_tracking": "Feb 25, 2013"
}