Skip to main content

 

 
8x8 Support

8x8 Analytics For Contact Center API, Creating keys and authenticating

Objective

Create keys and authenticate to use the 8x8 Analytics For Contact Center API.

Applies To

  • 8x8 Analytics For Contact Center
    • Historical metrics API
    • Real-time metrics API

Procedure

Create an API Key for Analytics for Contact Center

  1. Login to 8x8 Admin Console
  2. Click API Keys
  3. Click Create App
  4. Enter a name
  5. For API Products select Analytics for Contact Center
  6. Click Save

Admin Console API Keys Create Analytics for Contact Center.png

Admin Console API Keys Analytics for Contact Center.png

OAuth Authentication for 8x8 XCaaS APIs

  1. Request an access token from the 8x8 Authorization Server using Basic Authorization with your key and secret as the username and password, respectively.
  2. Combine and then encode your client credentials as a Base64 string
  3. Make a POST request to the 8x8 Authorization Server using your encoded credentials string in the Authorization header
  4. Obtain your access token from the server response

Example Request (cURL) 

In this example, we have provided cURL with the key and secret (cURL will generate the Authorization header)

curl --request POST --url https://api.8x8.com/oauth/v2/token -u 'key:secret' --header 'Content-type: application/x-www-form-urlencoded' --data grant_type=client_credentials

In this example, we have manually encoded the client credentials as a Base64 string and added the Authorization header

curl --request POST \
  --url https://api.8x8.com/oauth/v2/token \
  --header 'Authorization: Basic am9**********w=='\
  --header 'Content-type: application/x-www-form-urlencoded' \
  --data grant_type=client_credentials

Example Response 

{
    "access_token": "ey***********************Bw",
    "token_type": "BearerToken",
    "api_product_list": "[analytics realtime-api]",
    "status": "approved",
    "scope": "",
    "refresh_token_expires_in": "0",
    "expires_in": "1799",
    "refresh_count": "0",
    "developer.email": "deprecated",
    "issued_at": "1696345119513",
    "client_id": "deprecated",
    "api_product_list_json": [
        "analytics realtime-api"
    ]
}

In the Example Response, the access token is ey***********************Bw and the indicated expiration time is indicated by "expires_in": "1799" (seconds).

Example Request & Response (Postman) 

Postman OAuth_Authentication_for_8x8_XCaaS_APIs.png

 

8x8 Analytics For Contact Center Request

Use the access token as the Bearer Token when making requests to the 8x8 Analytics For Contact Center API

If the API is used for a multitenant customer the requests should contain "X-Tenant-Info" header variable where needs to specify the desired tenantId. The "X-Tenant-Info" header is not mandatory in case of a single tenant customer.

This example uses the fictional tenant name mytenantname01

Caution-Icon.png These examples use the eu region in the URL, you will need to use the correct region for your Tenant.

Example Request to Get Real-time metrics Queue Statistics (cURL) 

curl --location 'https://api.8x8.com/eu/analytics/cc/v5/realtime-metrics/queues' \
--header 'accept: application/json' \
--header 'X-Tenant-Info: mytenantname01' \
--header 'Authorization: Bearer ey***********************Bw'

Example Request & Response to Real-time metrics Queue Statistics (Postman)

Postman 8x8 Analytics For Contact Center Real-time metrics API Queue Statistics.png

  • Was this article helpful?