Jump to: navigation, search

Statistics API

REST API for Gathering Statistics

The name of the statistic is used for statistic definition in the statistics.yaml file. See the list of statistics to be monitored.

Query for Most Recent Statistic Values

The following request can be used to retrieve the most recent statistic values. For example:

HTTP Operation: GET

URL: http://example.com/api/v1/stats/{objectId}


Here is an example showing the results of a query with a specific object ID:

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


Query for Range of Statistic Values

The following request can be used to retrieve the range of values for a given object and statistic:

HTTP Operation: GET

URL: http://example.com/api/v1/stats/{objectId}/{statisticName}

There are some optional request parameters that can be added as follows:

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

Example requests:

Request: /stats/{objectId}/numCalls?numValues=10
Description: This will return the 10 most recent values for the numCalls statistic


Request: /stats/{objectId}/numCalls?from=1343779200000&to=1346457599999
Description: This will return all statistic values for the statistic numCalls for the month of August 2012


Request: /stats/{objectId}/numCalls?from=1343779200000&to=1346457599999&numValues=3
Description: This will return the 3 most recent (last) statistic values for the statistic numCalls within the month of August 2012

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

{
    "statusCode":0,
    "objectId": "888d13ad-e8aa-4532-a99a-eb8c6590e65a",
    "statistics": [
        {
            "statistic": "numCalls",
            "values": [
                {
                    "value": 300,
                    "time": 1344866399143
                },
                {
                    "value": 200,
                    "time": 1344866389143
                }
            ]
        }
    ]
}

Getting Service level statistic

To get the service level statistic the following entries must be present in statistics.yaml file:

--- 
#service level
name: ServiceLevel
notificationFrequency: 10
notificationMode: PERIODICAL
objectType: QUEUE
statisticDefinitionEx:
    category: TotalNumberInTimeRangePercentage
    dynamicTimeProfile: "0:00"
    intervalType: GrowingWindow
    mainMask: CallAnswered
    subject: DNAction
    timeRangeLeft: 0
    timeRangeRight: 60
--- 
name: ServiceLevel
notificationFrequency: 10
notificationMode: PERIODICAL
objectType: SKILL_Q
statisticDefinitionEx:
    category: TotalNumberInTimeRangePercentage
    dynamicTimeProfile: "0:00"
    intervalType: GrowingWindow
    mainMask: CallAnswered
    subject: DNAction
    timeRangeLeft: 0
    timeRangeRight: 60

They are already in the statistics.yaml file shipped. To get the list of the 100 most recent service level statistic values, use range query:

GET .../api/v1/stats/{objectId}/ServiceLevel?numValues=100 

where {objectId} should be substituted with id of skill or queue.

Skills should be provisioned using our provisioning UI/API or, if configured manually in Configuration Manager or Genesys Administrator, must satisfy restrictions specified in the Web Services Configuration Options.

This page was last edited on October 31, 2023, at 13:31.
Comments or questions about this documentation? Contact us for support!