Example: Get a Time-Based Statistic

This example demonstrates how to use a GET request to retrieve a time-based statistic.

For this example, we use the interactions-in-conversation-time statistic.

Request

Sample Request

The request below returns the length of time that active interactions have been in conversation:

curl GET https://api.cxengage.net/v1/tenants/7d23df20-2461-11e7-9bf4-b883f2d63b7b/realtime-statistics/interactions-in-conversation-time

Request Parameters

The table below lists the parameters you can include in a request:

Parameter Required? Type Description
tenantId yes UUID The tenant's unique identifier.

Response

Sample Response

The request returns JSON structured like the example below:


Response: 200 (OK){
   "results": {
   "count": 6,
   "min": 44457,
   "max": 1289929,
   "total": 1632799,
   "avg": 272133,
   "unit": "millis",
   "queryWindow": {
      "start": "2017-01-03T04:00:00Z",
      "end": "2017-01-04T03:59:59Z"
      }
   },
   "queryTime": 151
}

Response Parameters

The response includes the following parameters:

Parameter Type Description
count string The number of records that were used to compute the statistic.
min string The minimum length, in milliseconds, that interactions spent in conversation.
max string The maximum length, in milliseconds, that interactions spent in conversation.
total string The total amount of time, in milliseconds, that interactions spent in conversation.
avg string The average length, in milliseconds, that interactions spent in conversation.
unit string

How the value is measured. In this case, time.

queryWindow object

A JSON object containing the following parameters:

  • start – The start of the time interval, in UTC format, over which the statistics were computed.
  • end – The end of the time interval, in UTC format, over which the statistics were computed.
queryTime string

The length of time, in milliseconds, that it took for the API to respond to the call.