GET /insights/$slug

Raw data for a particular graph.

Resource URL

Type URL and Format
GET https://public-api.wordpress.com/rest/v1/insights/$slug

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 data points returned.
data (array) Numbers of actions by time stamp.
summaries (array) Summary for the current day/week/monthly/yearly/decade including % change.
started_tracking (string) The date stats began collecting.

Example

cURL

curl 'https://public-api.wordpress.com/rest/v1/insights/rest-api-calls'

PHP

<?php

$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
  ),
);

$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 Body

{
    "points": 29,
    "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": 13249
    },
    "summaries": {
        "last_24_hours": "4710",
        "percent_change_since_previous_24_hours": -4,
        "last_7_days": "30861",
        "percent_change_since_previous_7_days": 0.5,
        "last_31_days": "136019",
        "percent_change_since_previous_31_days": 4.8,
        "last_365_days": "631731",
        "percent_change_since_previous_365_days": 1373228.3
    },
    "started_tracking": "Feb 25, 2013"
}