Contents
- Real-Time Statistic API
- 1 API Description
API Description
Authenticate
Authenticate user on server. In the case of successful authentication, the server sets session cookies.
Note that the user must have privileges "Access Realtime Stats API", "View real-time agent metrics", and "View real-time service metrics" enabled, as well as be the assigned supervisor for the corresponding teams.
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> }
The token has the same value that is set in the server cookie. The cookie can also be supplied manually on a request using Cookie header.
Cookie:X-STATSAPI-TOKEN=88d41319-cb02-4d9a-a1f3-bd2611cd7f68; X-STATSAPI-TENANT=tenant.brightpattern.com; X-STATSAPI-LOGIN=john.smith
The cookie is valid until next user login into any wallboard (one cookie per user).
Create subscription
Creates subscription for specific set of metrics. Each 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>", "stat_name": "<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>", "stat_name": "<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
Deletes active subscription, clears data cache on server
URI
https://{host:port}/statsapi/subscription/active
HTTP Method
DELETE
Get available agents
Gets "true" or "false" value for agents ready to handle a specific service.
URI
https://{tenant_url:port}/statsapi/info/check_available_agents?service={service-name}
HTTP Method
GET
Note: No authentication or subscription is needed.
Response
- 200 – OK
{ “availability”: [ true | false ] }
- True – "Number of ready agents" > 0 for the specific service (i.e., at least one agent is available)
- False – "Number of ready agents" is 0 for the specific service (i.e., no agent is available)
Get dispositions
Gets 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>", ...] }
Get file
Gets the audio file of a recording.
URL
http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/audio?giid=<GIID>&stepid=<stepId>
HTTP Method
GET
Body
Empty
RESULT
Audio file (WAV)
Response Codes
- 200 – Success
- 401 – Authentication failed
- 403 – User authenticated, but does not have sufficient privileges
- 404 - File not found
Get subscription data
Gets statistics data of an 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>" } ] } }