Line 164: | Line 164: | ||
=== URL === | === URL === | ||
− | http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/audio?giid=<GIID> | + | http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/audio?giid=<GIID>&stepid=<stepId> |
=== HTTP Method === | === HTTP Method === | ||
Line 186: | Line 186: | ||
=== URL === | === URL === | ||
− | http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/metadata?giid=<GIID> | + | http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/metadata?giid=<GIID>&stepid=<stepId> |
=== HTTP Method === | === HTTP Method === | ||
Line 213: | Line 213: | ||
"RecordingId":"20170810101832_3001_A3BF72D5E65846F1A2387CA11F7AD4ED.wav", | "RecordingId":"20170810101832_3001_A3BF72D5E65846F1A2387CA11F7AD4ED.wav", | ||
"Global Interaction ID":"F663B850-6FC4-4B5E-9DC4-69E62FADD0E4", | "Global Interaction ID":"F663B850-6FC4-4B5E-9DC4-69E62FADD0E4", | ||
− | "Review URL":"https://example.com/admin?giid=40C6CA6E-98E2-4116-86EF-925883CFFE36", | + | "Review URL":"https://example.com/admin?giid=40C6CA6E-98E2-4116-86EF-925883CFFE36&stepId=A3BF72D5-E658-46F1-A238-7CA11F7AD4ED", |
"Screen Recording":"0" | "Screen Recording":"0" | ||
} | } |
Revision as of 21:57, 16 July 2019
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 metadata
Gets the metadata of a recording.
URL
http[s]://<host>:<port>/admin/ws/t/<tenant_url>/recordings/metadata?giid=<GIID>&stepid=<stepId>
HTTP Method
GET
Body
Empty
RESULT
JSON object
Example
{ "Start Time":"08/10/2017 10:18:32 AM PDT -07:00", "Agent loginId":null, "Agent First Name":null, "Agent Last Name":null, "Customer phone":"3001", "Direction":"INBOUND", "Service":null, "Disposition":null, "Notes":"", "Voice Signature":"0", "Flagged":"0", "Talk Time":"0:23", "RecordingId":"20170810101832_3001_A3BF72D5E65846F1A2387CA11F7AD4ED.wav", "Global Interaction ID":"F663B850-6FC4-4B5E-9DC4-69E62FADD0E4", "Review URL":"https://example.com/admin?giid=40C6CA6E-98E2-4116-86EF-925883CFFE36&stepId=A3BF72D5-E658-46F1-A238-7CA11F7AD4ED", "Screen Recording":"0" }
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>" } ] } }