Updated Endpoint

The [Call Legs](πŸ”—ο»Ώ) and [Call Detail Records](πŸ”—ο»Ώ) are dedicated endpoints to replace the previous [Call Detail Record Legs](πŸ”—ο»Ώ) endpoint which served both purposes

# Call Legs Explained

A Call Record is a single record view of the overall call and metrics represented by a single Call ID.

A Call Leg provides detailed metrics on an individual segment of a call within the call journey and is represented by a Call Leg ID combined with a Call ID.

Example: A Call Record would be a single row representation of a call that follows the following path which would have multiple Call Legs to fully represent the journey.

  • Inbound to an Auto Attendant

  • Transferred to Ring Group

  • Simultaneous calls to 5 Ring Group members (Leg per member contacted regardless of outcome)

  • Answered by one of the members

ο»Ώ[8x8 Work Analytics Historical](πŸ”—ο»Ώ) access is via this multi step process. For any of the endpoints the same process is followed.

You will need a working API key to begin

You can generate API credentials from [How to get API Keys](πŸ”—ο»Ώ)ο»Ώ

The `8x8-api-key` will be the `Key` generated. For Work Analytics the Secret from Admin Console is not required.

Use the following base URL during this process:

  • `https://api.8x8.com/analytics/work`

# 1. Authenticate to retrieve access token

You will use your API key combined with the user credentials of a user with permission and access to Work Analytics to authenticate, this user **does not need to be** the one who generated the API credentials

User must access Analytics at least once via browser

The users credentials will not be able to leverage the API until they have used Work Analytics via browser at least once

## Parameters

**Method: POST**

### Headers

NameRequiredDescriptionExample
8x8-apikeyβœ“The 8x8-api key providedtest_key_kjdfidj238jf9123df221
Content-Typeβœ“Set content type to form-urlencodedapplication/x-www-form-urlencoded

### Body

NameRequiredDescriptionExample
usernameβœ“The 8x8 username of a user with Work Analytics access privileges[email protected]
passwordβœ“The 8x8 password of the user with Work Analytics access privilegesRrnp5QBW6dTbx^TP

## Authentication Request:

ο»Ώ

## Authentication Response:

**Response**

ο»Ώ

**Outputs For Next Step:**

  • access_token

  • expires_in

The token will expire in the number of seconds specified in expires_in.

The following steps will use the access_token as a Bearer Token form of authentication. This takes the form of the `Authorization` header being set to `Bearer access_token` (Space between Bearer and the access_token)

# 2. Run Report

## Parameters

**Method:** GET

### Headers

NameRequiredDescriptionExample
Authorizationβœ“Pass the access_token returned from the authentication request as a Bearer token `Bearer {access_token}`Bearer eyJhbGciOiJSUzI1NiJ9.yyyyyyy.zzzzzzzzzzz

### Path

NameRequiredDescriptionExample
versionβœ“The current version for cdr is v1v1

### Query

NameRequiredDescriptionExample
pbxIdβœ“Pass the pbxId (PBX Name) of the requested pbx or comma separated list of pbxIds or `allpbxes` for all of the pbxs in the customer account. PBX names can be found [here in Admin Console](πŸ”—ο»Ώ)ο»Ώ`acmecorp,acmecorp2`
startTimeβœ“The interval start time for CDR searches - the format is YYYY-MM-DD HH:MM:SS.2022-10-20 08:30:00
endTimeβœ“The interval end time for CDR searches - the format is YYYY-MM-DD HH:MM:SS.2022-10-20 19:00:00
timeZoneβœ“ο»Ώ[IANA Time Zones](πŸ”—ο»Ώ). Examples America/New_York, Europe/London [Wikipedia Time Zone List](πŸ”—ο»Ώ)ο»ΏAmerica/New_York
pageSizeβœ“Number of records to return in pages See [Pagination](πŸ”—ο»Ώ). Must be 50
scrollId☐/βœ“Not required for initial page required on subsequent pages. See [Pagination](πŸ”—ο»Ώ)ο»Ώο»Ώ
isConnectTime☐This parameter allows you to get your results based on either connect time or disconnect time of each call leg. Default is false. See [isConnectTime explained](πŸ”—ο»Ώ) for more details.false
isSimplified☐Only valid for Call Legs. Default is false. When true: Child calls are not returned. For example, child calls are the ones the service makes to one or more agents when a call comes into a call queue or a ring group. Some call legs are omitted. For example, the removal of CallForking and CallRecording legs.false

### isConnectTime explained

This looks at the timing of call legs and as such is not valid for call records

if `false` will use 'disconnected_time' of the call leg to filter data and return the result

if `true` will use the 'connected_time' of the call leg to filter data and return the result

**disconnected_time** is when the** call leg** was disconnected from the system

**connected_time** is when the **call leg** transitioned from alerting to connected.

## Call Legs Request

As per the Open API specification guidelines, we have migrated the URLs for Call Leg Report as give in the below table :

Deprecated URL VersionMigrated URL (Current version)
v1/cdr?isCallRecord=falsev2/call-legs

Try out the CDR Legs Request

Jump in and try it out in the [CDR Legs Reference](πŸ”—ο»Ώ)ο»Ώ

ο»Ώ

## Call Legs Response

For details on call legs metrics please refer to[CDR Glossary and Details](πŸ”—ο»Ώ)ο»Ώ

ο»Ώ

Follow the pagination steps below to retrieve subsequent pages.

#### Pagination

Within Work Analytics Only the /call-records and /call-legs endpoints are subject to pagination. This is controlled by `pageSize` and `scrollId`

  • `pageSize` is the number of records to return per page and is required for /call-legs

  • `scrollId ` is returned from /call-legs requests providing an id for the next page of results.

**Pagination Example** Assuming there will be 81 records in total. With an initial input of `pageSize=50` the returned meta data will be as follows. Note: data has been truncated to an empty array to limit the size of the example text

ο»Ώ

The request for the next page would include scrollId set as the value returned in the previous request `pageKey=50&scrollId=c3VwZXJ0ZW5hbnRjc21fMTYzNTU3MTA0ODQ4Nl8xXzE2NDM5MTIzNTI0NDE`

The new result set would look as follows. The returned result set would only have 31 elements.

ο»Ώ

The request for the next page would be `pageKey=50&scrollId=c3VwZXJ0ZW5hbnRjc21fMTYzNTU3MTA0ODM0NV8xXzE2NDM4OTc0OTI5MDM` the scrollId has been set to the value returned in the previous request

ο»Ώ