Skip to main content
8x8 Support

How to Use Status Log API for Agent Statistics in ContactNow

Overview

API "status_log" method is used to read agent statistics (status changes; and based on this you can calculate the time spent on e.g. idle, available, call etc.).

To create access tokens for the ContactNow API, you will need to create a case with 8x8 Technical Support to obtain an API username and key. Once you have the username and key, you can use the instructions on the following link to create a token for using the API functionality. ContactNow API Access.

Note-Icon.png

8x8 does not provide programming support for the ContactNow API. However, further API reference material is linked in the Documentation section at the bottom of this article.

Applies To

ContactNow, API, status_log, agents

Procedure

Access the ContactNow API URL

To access any ContactNow API interface, requests need to have an access token. The token will authorize requests for a particular account for a fixed period of time. By default, these requests are restricted to the internet address that requests the token.

The API url to get the analytics is:

https://api.contactnow.8x8.com/database.php?token={TOKEN}&method=status_log&action=read&format={FORMAT}&raw=1

The "status_log" API has a number of available functions. The request arguments should be passed as HTTP Get. The response from the API can be formatted in either "json" or "xml" format. The default is "json" but this can be modified by the format argument below:

    Format: "xml" or "json"

    HTTP Request: GET
    Method: status_log
    Action: read
    Arguments:

  • uid: match id's >= to this value. a range of values can be specified by using the format low:high
  • agent: agent id or comma seperated list of agent id's
  • tstart: unixtime of first entry to match
  • tstop: unixtime of last entry to match

The API will output a number of optional values depending on the request made.

  • success: This shows whether the request succeeded. It will contain a true or false value for "json" or a 1 or 0 for "xml".
  • total: Number of records affected.
  • list: Data extracted from within the database. The data will be split in multiple fields.
  • uid: Unique ID Reference
  • uts: Date and Time in UNIX format
  • agent: Agent ID
  • status: Agent Status
  • callid: If the agent is on call, the Call ID will be automatically provided

 

Example of JSON Response:

{
    "success": true,
    "total": 1,
    "list": [
        {
            "uid": "12345678901",
            "uts": "1234567890",
            "agent": "1234567",
            "status": "offline",
            "subcode": "",
            "callid": "0"
        }
    ]
}

Example of XML Response:

<result>
    <success>1</success>
    <total>1</total>
    <list>
        <status_log>
            <uid>12345678901</uid>
            <uts>1234567890</uts>
            <agent>1234567</agent>
            <status>offline</status>
            <subcode />
            <callid>0</callid>
        </status_log>
    </list>
</result>