Jump to: navigation, search

Get most recent statistic values

You can use the following request retrieve the most recent statistic values for a specific object ID:

GET api/v1/stats/{objectId}

For example:

GET api/v1/stats/e653a99ae8a74dd5bfb5c7be57bd8c65

Returns:

{
       "objectId": "e653a99ae8a74dd5bfb5c7be57bd8c65",
       "statusCode":0,
       "statistics": [
           {
               "statistic": "numAnsweredCalls",
               "value": 222,
               "time": 1345144080379
           },
           {
               "statistic": "numCalls",
               "value": 500,
               "time": 1345143997464
           },
           {
               "statistic": "numDroppedCalls",
               "value": 200,
               "time": 1345144064936
           }
       ]
   }

If you need to get an individual statistic, you can parse the results of the query for the particular statistic.

Query for Range of Statistic Values

Use the following request to retrieve the range of historical values for a given object and statistic:

GET api/v1/stats/{objectId}/{statisticName}

These historical values are only stored for statistics that have the saveHistory: true property.

Parameters

Parameter Description
numValues The default is '1' if this parameter is not provided. This can be set to a larger number to retrieve multiple statistic values. For example, if set to "100", it returns the last 100 values, if there are that many. (optional)
from Sets the start of time range that you are interested in. (optional)
to Sets the end of time range that you are interested in. (optional)

Example Requests

Request Description
api/v1/stats/{objectId}/numCalls?numValues=10 Returns the 10 most recent values for the numCalls statistic.
api/v1/stats/{objectId}/numCalls?from=1343779200000&to=1346457599999 Returns all statistic values for the statistic numCalls for the month of August 2012.
api/v1/stats/{objectId}/numCalls?from=1343779200000&to=1346457599999&numValues=3 Returns the 3 most recent (last) statistic values for the statistic numCalls within the month of August 2012.

Example Response

The format response to the GET request is the same regardless of the parameters supplied:

{
    "statusCode":0,
    "objectId": "888d13ad-e8aa-4532-a99a-eb8c6590e65a",
    "statistics": [
        {
            "statistic": "numCalls",
            "values": [
                {
                    "value": 300,
                    "time": 1344866399143
                },
                {
                    "value": 200,
                    "time": 1344866389143
                }
            ]
        }
    ]
}
This page was last edited on June 10, 2016, at 19:42.
Comments or questions about this documentation? Contact us for support!