From Bright Pattern Documentation
< 3.10:Real-time-statistics-api
Revision as of 16:54, 19 September 2016 by Sergem (talk | contribs) (Authenticate)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
• 3.10 • 3.12 • 3.13 • 3.14 • 3.15 • 3.16 • 3.17 • 3.18

Contents

Authenticate

Authenticate user on server. In case of successful authentication server set session cookies.

Note that the user must have "Access Realtime Stats API", "View real-time agent metrics", and "View real-time service metrics", as well as to be assigned as a supervisor on 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>
}

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>",
                        "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

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>", ...] 
}
Next >