Contents
- Real-Time Statistic API
- 1 Authenticate
- 2 Create subscription
- 3 Delete subscription
- 4 Get subscription data
- 5 Get dispositions
Authenticate
Authenticate user on server. In case of successful authentication server set session cookies
URI | https://{host:port}/statsapi/auth |
HTTP Method | POST |
Body:
{ "tenant_url" : "<tenant_url>", "username" : "<username>", "password" : "<password>" }
Response:
401 – Unauthorized
200 – OK
{ "token": <token> }
Create subscription
Create subscription for specific set of metrics. One client can have only one active subscription
URI | https://{host:port}/statsapi/subscription |
HTTP Method | POST |
Body:
{ "<app id>": { "stats_totals": ["statistic name" ], //array of statistics "service_grids": [//array of service grid definitions { "id": "<grid Id>", "columns": [//array of stats for columns { "id": "<column id>", "statName": "<statistic protocol name>|SUM", "sum_stat_names": ["<(optional)list of statistic protocol name for sum>"] } ], "order_by": "<column id>", "order_dir": "ASC|DESC", "limit": "<count of top records>", "filter_by": "<column id>", "filter_value": "<value>", "filter_operation": "EQ|NE|LT|GT|LE|GE" } ], "agent_grids": [ //array of agent grid definitions { "id": "<grid Id>", "columns": [//array of stats for columns { "id": "<column id>", "statName": "<statistic protocol name>|SUM", "dispositions": ["<(optional)list of dispositions>"], "sum_stat_names": ["<(optional)list of statistic protocol name for sum>"] } ], "order_by": "<column id>", "order_dir": "ASC|DESC", "limit": "<count of top records>", "filter_by": "<column id>", "filter_value": "<value>", "filter_operation": "EQ|NE|LT|GT|LE|GE" } ] "chat_messages": {//top of internal chat messages "filter": "<filter by message content>", "limit": "<count of top records>" }, } }
Response:
400 – Bad Request
{ "error_code": <error code>, "error_message": "<error message>" }
401 – Unauthorized
409 – limit of active subscriptions exceeded for tenant
200 – OK subscription was created
Delete subscription
Delete active subscription, clear data cache on server
URI | https://{host:port}/statsapi/subscription/active |
HTTP Method | DELETE |
Get subscription data
Get statistics data of active subscription
URI | https://{host:port}/statsapi/subscription/data |
HTTP Method | GET |
Response:
401 – Unauthorized
404 – Bad Request (There is no active subscription)
204 –No Content (Data is not ready yet)
200 – OK
{ { "<app id>": { "stats_totals": {//array of single statistics "<statistic name>": <statistic value> }, "service_grids": [//array of service grids { "id": "<grid Id>", "values": [ { "<column id>": "<statistic value>" } ] }
], "agent_grids": [ //array of agent grids { "id": "<grid Id>", "values": [ { "<column id>": "<statistic value>" } ] } ], "chat_messages": [ { "id": "<message id>", "login_id": "<sender loginId>", "first_name": "<sender first name>", "last_name": "<sender last name>", "send_time": "<utc timestamp>", "is_urgent": "1|0", "content": "<chat message>" } ] } }
Get dispositions
Get disposition names for all supervised services
URI | https://{host:port}/statsapi/cfg/dispositions |
HTTP Method | GET |
Url parameters:
agentCanSelect = 1
inbound = 1
outbound = 1
preview = 1
Response:
401 – Unauthorized
200 – OK
{ "dispositions": ["<disposition name>", ...]}