/stats

Use /stats to retrieve daily statistics for folders from a specified date range. /stats supports GET requests only.

To retrieve application and category scores, use /appstats.

Synopsis

GET /stats/$co_short/$org_short?token=$token&daterange=$daterange
GET /stats/$co_short/$org_short/$folder?token=$token&daterange=$daterange
$co_short

Company short name used to filter the request.

$org_short

Organization short name used to filter the request.

$folder
Folder used to filter the request.
$token

Authorization token with the required read or write permissions for the request.

daterange=$start-$end

Filters the request by the dates specified in the range [$start, $end]. Values for $start and $end are optional, but the hyphen between them is required.

The range specified by $start and $end may be expressed using any combination of years, months, days, hours, minutes, and seconds, expressed as YYYYMMDD[HHmmss]. Date ranges are always assumed to be positive (where $start is less than $end).

daterange filters by values in the transcript record's datetime field. Data for the datetime field is stored using the organization's time zone, which may vary by organization.

No verification is done to ensure that daterange values are correct; invalid date ranges will simply return no values. If $start is not specified, a default value of 01 January, 1900 is used. If $end is not specified, the current date is used.

Example requests

The following example retrieves statistics for folder2 on the current date.

curl -s 'http://example.company.com:3000/stats/Docs/Docs-Testing/folder2?token=$token'

The following example retrieves statistics for folder2 on a single day.

curl -s 'http://example.company.com:3000/stats/Docs/Docs-Testing/folder2?token=$token&daterange=20211018-20211018'

Example Python implementation

Use the api_get_stats.py with these command-line arguments:

python api_get_stats.py $host $token /stats/$co_short/$org_short/$folder '&daterange=20211005'

This call uses the daterange parameter to limit results to those from files processed on a single date (October 5, 2021), and includes only the Politeness category.

$host
Hostname or URL for the system running V‑Spark.
$token

Authorization token with the required read or write permissions for the request.

$co_short

Company short name used to filter the request.

$org_short

Organization short name used to filter the request.

daterange=$start-$end

Filters the request by the dates specified in the range [$start, $end]. Values for $start and $end are optional, but the hyphen between them is required.

The range specified by $start and $end may be expressed using any combination of years, months, days, hours, minutes, and seconds, expressed as YYYYMMDD[HHmmss]. Date ranges are always assumed to be positive (where $start is less than $end).

daterange filters by values in the transcript record's datetime field. Data for the datetime field is stored using the organization's time zone, which may vary by organization.

No verification is done to ensure that daterange values are correct; invalid date ranges will simply return no values. If $start is not specified, a default value of 01 January, 1900 is used. If $end is not specified, the current date is used.

Example output

[
    {
        "date": "20170925",
        "calls": 5,
        "avgduration": "0:09:52",
        "avgsilence": "0:04:12",
        "avgwords": 1256.6,
        "agent": {
            "avgcalls": "1.7",
            "talk": {
                "avg": "0:02:57",
                "min": {
                    "id": "004",
                    "duration": "0:00:32"
                },
                "max": {
                    "id": "002",
                    "duration": "0:09:24"
                }
            },
            "emotion": {
                "positive": 3,
                "worsening": 0,
                "negative": 2,
                "improving": 0
            }
        },
        "client": {
            "talk": {
                "avg": "0:02:43"
            },
            "emotion": {
                "positive": 1,
                "worsening": 0,
                "negative": 3,
                "improving": 1
            }
        }
    }
]