|  Login

Analytics API

The Analytics API complements the Account Management API and allows you to access statistics on API usage from 3scale’s management system.

Version:

The current version of this API is v2.0.

Servers:

API calls must go to your administration domain location – usually this takes the form “http://developer-admin.yoursite.com/”. Ask your account representative if you are not sure of the URL).

Note: these domains are different from the domain used by the service management API.

Service Usage: GET stats/services/:service_id/usage

Returns usage data by metric for a specified period of time for a service.

URL

http://api.3scale.net/stats/services/<service_id>/usage.<format>

Supported formats

json, xml

Supported request methods

Rate Limited
  • true:

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘metric_name’ – System name of metric for which to get data.
  • ‘period’ – Length of the period of data. Possible values: month, week, day and hour
Optional
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27

Example requests

XML
http://api.3scale.net/stats/services/1/usage.xml?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

<?xml version="1.0" encoding="UTF-8"?>
<usage>
<metric>
  <id>16</id>
  <name>Hits</name>
  <system_name>hits</system_name>
  <unit></unit>
</metric>
<period>
  <since>2011-01-01 00:00:00 UTC</since>
  <until>2011-02-01 23:59:59 UTC</until>
  <name>month</name>
  <granularity>day</granularity>
</period>
<data>
  <total>3011</total>
  <values length="32">0,72,137,154,48,47,11,162,157,0,0,47,116,13,170,70,126,63,202,121,31,135,41,38,79,99,252,131,50,265,80,94</values>
</data>
</usage>
JSON
http://api.3scale.net/stats/services/1/usage.json?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

 {
  "metric": {
    "unit": "hit",
    "name": "Hits",
    "id": 16,
    "system_name": "hits"
},
"total": 3011,
"period": {
    "granularity": "day",
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
},
"values": [0, 72, 137, 154, 48, 47, 11, 162, 157, 0, 0, 47, 116, 13, 170, 70, 126, 63, 202, 121, 31, 135, 41, 38, 79, 99, 252, 131, 50, 265, 80, 94]
}

Application Usage: GET stats/applications/:application_id/usage

Returns usage data for all methods for an application.

URL

http://api.3scale.net/stats/applications/<application_id>/usage.<format>

Supported formats

json, xml

Supported request methods

GET

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘metric_name’ – System name of metric for which to get data.
  • ‘period’ – Length of the period of data. Possible values: month, week, day and hour
Optional
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27

Example requests

XML
http://api.3scale.net/stats/applications/12/usage.xml?provider_key=xxxxxxx&period=week&since=2011-02-01&metric_name=hits
 <?xml version="1.0" encoding="UTF-8"?>
<metric>
  <id>16</id>
  <name>Hits</name>
  <system_name>hits</system_name>
  <unit>hit</unit>
</metric>
<period>
  <since>2011-01-01 00:00:00 UTC</since>
  <until>2011-02-01 23:59:59 UTC</until>
  <name>month</name>
  <granularity>day</granularity>
</period>
<data>
 <total>1764</total>
 <values length="32">0,0,0,55,48,0,0,96,81,0,0,47,116,13,77,70,5,54,177,60,0,135,41,34,79,36,252,0,50,64,80,94</values>
</data>
<application>
  <value></value>
  <id>86</id>
  <name>demopop</name>
  <plan>
    <id>96</id>
    <name>Sandbox </name>
  </plan>
  <account>
    <name>pingar</name>
    <id>126</id>
  </account>
</application>
JSON
http://api.3scale.net/stats/applications/12/usage.json?provider_key=xxxxxxx&period=week&since=2011-02-01&metric_name=hits

{
 "application": {
    "state": "live",
    "plan": {
        "name": "Sandbox ",
        "id": 96
    },
    "description": "shows how its done",
    "name": "demopop",
    "id": 86,
    "account": {
        "name": "pingar",
        "id": 126
    }
},
"metric": {
    "unit": "hit",
    "name": "Hits",
    "id": 16,
    "system_name": "hits"
},
"period": {
    "granularity": "day",
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
},
"total": 1764,
"values": [0, 0, 0, 55, 48, 0, 0, 96, 81, 0, 0, 47, 116, 13, 77, 70, 5, 54, 177, 60, 0, 135, 41, 34, 79, 36, 252, 0, 50, 64, 80, 94]
}

Top Applications: GET stats/services/:service_id/top_applications

Returns usage and application data for the most active applications.

URL

http://api.3scale.net/stats/services/<em>:service_id</em>/top_applications.<em>format</em>

Supported formats

json, xml

Supported request methods

GET

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘metric_name’ – System name of metric for which to get data.
  • ‘period’ – Length of the period of data. Possible values: month, week, day and hour
Optional
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27

Example requests

XML
http://api.3scale.net/stats/services/1/top_applications.xml?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

 

 <?xml version="1.0" encoding="UTF-8"?>
  <metric>
  <id>16</id>
  <name>Hits</name>
  <system_name>hits</system_name>
  <unit>hit</unit>
</metric>
<period>
  <name>month</name>
  <since>2011-01-01 00:00:00 UTC</since>
  <until>2011-02-01 23:59:59 UTC</until>
</period>

 

<application>
  <value>1670</value>
  <id>86</id>
  <name>demopop</name>
  <plan>
    <id>96</id>
    <name>Sandbox </name>
  </plan>
  <account>
    <name>pingar</name>
    <id>126</id>
  </account>
</application>
<application>
  <value>1247</value>
  <id>96</id>
  <name>second demo</name>
  <plan>
    <id>96</id>
    <name>Sandbox </name>
  </plan>
  <account>
    <name>Provoke</name>
    <id>66</id>
  </account>
</application>
JSON
http://api.3scale.net/stats/services/1/top_applications.json?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

{
 "metric": {
    "unit": "hit",
    "name": "Hits",
    "id": 16,
    "system_name": "hits"
},
"period": {
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
},
"applications": [{
    "value": "1670",
    "plan": {
        "name": "Sandbox",
        "id": 96
    },
    "name": "demopop",
    "id": 86,
    "account": {
        "name": "pingar",
        "id": 126
    }
},
{
    "value": "1247",
    "plan": {
        "name": "Sandbox",
        "id": 96
    },
    "name": "second demo",
    "id": 96,
    "account": {
        "name": "Provoke",
        "id": 66
    }
}]
}

Methods Usage: GET stats/services/:service_id/methods_usage

Returns usage data for all methods belonging to a service.

URL

http://api.3scale.net/stats/services/<:service_id>/methods_usage.<format>

Supported formats

json, xml

Supported request methods

GET

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘period’ – Length of the period of data. Possible values: Imonth, week, day and hour_
Optional
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27

Example requests

XML

http://api.3scale.net/stats/services/1/methods_usage.xml?provider_key=xxxxxxx&period=week&since=2011-02-01<

<?xml version=”1.0″ encoding=”UTF-8″?>

<since>2011-01-01 00:00:00 UTC</since>
<until>2011-02-01 23:59:59 UTC</until>
<name>month</name>
<granularity>day</granularity>

 

<metric>
  <id>56</id>
  <name>GetAutocompleteSuggestions</name>
  <system_name>GetAutocompleteSuggestions</system_name>
  <unit>hit</unit>
  <data>
    <total>0</total>
    <values length="32">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</values>
  </data>
</metric>
<metric>
  <id>66</id>
  <name>GetAlternativeQueries</name>
  <system_name>GetAlternativeQueries</system_name>
  <unit>hit</unit>
  <data>
    <total>0</total>
    <values length="32">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</values>
  </data>
</metric>
JSON
http://api.3scale.net/stats/services/1/methods_usage.json?provider_key=xxxxxxx&period=week&since=2011-02-01

 


{
"metrics": [{
    "unit": "hit",
    "name": "GetAutocompleteSuggestions",
    "id": 56,
    "data": {
        "total": 0,
        "values": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    },
    "system_name": "GetAutocompleteSuggestions"
},
{
    "unit": "hit",
    "name": "GetAlternativeQueries",
    "id": 66,
    "data": {
        "total": 0,
        "values": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    },
    "system_name": "GetAlternativeQueries"
}],
"period": {
    "granularity": "day",
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
}
}

Top Applications: GET stats/services/:service_id/top_applications

Returns usage and application data for the top 10 most active applications.

URL

http://api.3scale.net/stats/services/<em>:service_id</em>/top_applications.<em>format</em>

Supported formats

json, xml

Supported request methods

GET

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘metric_name’ – System name of metric for which to get data.
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27
  • ‘period’ – Length of the period of data. Possible values: month, day and hour
Optional

Example requests

XML
http://api.3scale.net/stats/services/1/top_applications.xml?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

<?xml version="1.0" encoding="UTF-8"?>
<metric>
  <id>16</id>
  <name>Hits</name>
  <system_name>hits</system_name>
  <unit>hit</unit>
</metric>
<period>
  <name>month</name>
  <since>2011-01-01 00:00:00 UTC</since>
  <until>2011-02-01 23:59:59 UTC</until>
</period>

<application>
  <value>1670</value>
  <id>86</id>
  <name>demopop</name>
  <plan>
    <id>96</id>
    <name>Sandbox </name>
  </plan>
  <account>
    <name>pingar</name>
    <id>126</id>
  </account>
</application>
<application>
  <value>1247</value>
  <id>96</id>
  <name>second demo</name>
  <plan>
    <id>96</id>
    <name>Sandbox </name>
  </plan>
  <account>
    <name>Provoke</name>
    <id>66</id>
  </account>
</application>

JSON
http://api.3scale.net/stats/services/1/top_applications.json?provider_key=xxxxxxx&metric_name=hits&period=week&since=2011-02-01

}
"metric": {
    "unit": "hit",
    "name": "Hits",
    "id": 16,
    "system_name": "hits"
},
"period": {
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
},
"applications": [{
    "value": "1670",
    "plan": {
        "name": "Sandbox",
        "id": 96
    },
    "name": "demopop",
    "id": 86,
    "account": {
        "name": "pingar",
        "id": 126
    }
},
{
    "value": "1247",
    "plan": {
        "name": "Sandbox",
        "id": 96
    },
    "name": "second demo",
    "id": 96,
    "account": {
        "name": "Provoke",
        "id": 66
    }
}]
}

Methods Usage: GET stats/services/:service_id/methods_usage

Returns usage data for all methods belonging to a service.

URL

http://api.3scale.net/stats/services/<:service_id>/methods_usage.<format>

Supported formats

json, xml

Supported request methods

GET

Parameters

Required
  • ‘provider_key’ – Provider’s API key for authentication.
  • ‘since’ – Date from when period should start. Example dates: 2010-12-01, 2010-1-27
  • ‘period’ – Length of the period of data. Possible values: month, day and hour_
Optional

Example requests

XML

http://api.3scale.net/stats/services/1/methods_usage.xml?provider_key=xxxxxxx&period=week&since=2011-02-01

<?xml version="1.0" encoding="UTF-8"?>
<since>2011-01-01 00:00:00 UTC</since>
<until>2011-02-01 23:59:59 UTC</until>
<name>month</name>
<granularity>day</granularity>

<metric>
  <id>56</id>
  <name>GetAutocompleteSuggestions</name>
  <system_name>GetAutocompleteSuggestions</system_name>
  <unit>hit</unit>
  <data>
    <total>0</total>
    <values length="32">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</values>
  </data>
</metric>
<metric>
  <id>66</id>
  <name>GetAlternativeQueries</name>
  <system_name>GetAlternativeQueries</system_name>
  <unit>hit</unit>
  <data>
    <total>0</total>
    <values length="32">0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0</values>
  </data>
</metric>

JSON
http://api.3scale.net/stats/services/1/methods_usage.json?provider_key=xxxxxxx&period=week&since=2011-02-01

{
"metrics": [{
    "unit": "hit",
    "name": "GetAutocompleteSuggestions",
    "id": 56,
    "data": {
        "total": 0,
        "values": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    },
    "system_name": "GetAutocompleteSuggestions"
},
{
    "unit": "hit",
    "name": "GetAlternativeQueries",
    "id": 66,
    "data": {
        "total": 0,
        "values": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    },
    "system_name": "GetAlternativeQueries"
}],
"period": {
    "granularity": "day",
    "until": "2011-02-01T23:59:59Z",
    "since": "2011-01-01T00:00:00Z",
    "name": "month"
}
}