Amazon Connect Service
API Reference (API Version 2017-08-08)

GetMetricData

The GetMetricData operation retrieves historical metrics data from your Amazon Connect instance.

If you are using an IAM account, it must have permission to the connect:GetMetricData action.

Request Syntax

POST /metrics/historical/InstanceId HTTP/1.1 Content-type: application/json { "EndTime": number, "Filters": { "Channels": [ "string" ], "Queues": [ "string" ] }, "Groupings": [ "string" ], "HistoricalMetrics": [ { "Name": "string", "Statistic": "string", "Threshold": { "Comparison": "string", "ThresholdValue": number }, "Unit": "string" } ], "MaxResults": number, "NextToken": "string", "StartTime": number }

URI Request Parameters

The request requires the following URI parameters.

InstanceId

The identifier for your Amazon Connect instance. To find the ID of your instance, open the AWS console and select Amazon Connect. Select the alias of the instance in the Instance alias column. The instance ID is displayed in the Overview section of your instance settings. For example, the instance ID is the set of characters at the end of the instance ARN, after instance/, such as 10a4c4eb-f57e-4d4c-b602-bf39176ced07.

Length Constraints: Minimum length of 1. Maximum length of 100.

Request Body

The request accepts the following data in JSON format.

EndTime

The timestamp, in UNIX Epoch time format, at which to end the reporting interval for the retrieval of historical metrics data. The time must be specified using an interval of 5 minutes, such as 11:00, 11:05, 11:10, and must be later than the StartTime timestamp.

The time range between StartTime and EndTime must be less than 24 hours.

Type: Timestamp

Required: Yes

Filters

A Filters object that contains a list of queue IDs or queue ARNs, up to 100, or a list of Channels to use to filter the metrics returned in the response. Metric data is retrieved only for the resources associated with the IDs, ARNs, or Channels included in the filter. You can use both IDs and ARNs together in a request. Only VOICE is supported for Channel.

To find the ARN for a queue, open the queue you want to use in the Amazon Connect Queue editor. The ARN for the queue is displayed in the address bar as part of the URL. For example, the queue ARN is the set of characters at the end of the URL, after 'id=' such as arn:aws:connect:us-east-1:270923740243:instance/78fb859d-1b7d-44b1-8aa3-12f0835c5855/queue/1d1a4575-9618-40ab-bbeb-81e45795fe61. The queue ID is also included in the URL, and is the string after 'queue/'.

Type: Filters object

Required: Yes

Groupings

The grouping applied to the metrics returned. For example, when results are grouped by queueId, the metrics returned are grouped by queue. The values returned apply to the metrics for each queue rather than aggregated for all queues.

The current version supports grouping by Queue

If no Grouping is included in the request, a summary of HistoricalMetrics for all queues is returned.

Type: Array of strings

Array Members: Maximum number of 2 items.

Valid Values: QUEUE | CHANNEL

Required: No

HistoricalMetrics

A list of HistoricalMetric objects that contain the metrics to retrieve with the request.

A HistoricalMetric object contains: HistoricalMetricName, Statistic, Threshold, and Unit.

You must list each metric to retrieve data for in the request. For each historical metric you include in the request, you must include a Unit and a Statistic.

The following historical metrics are available:

CONTACTS_QUEUED

Unit: COUNT

Statistic: SUM

CONTACTS_HANDLED

Unit: COUNT

Statistics: SUM

CONTACTS_ABANDONED

Unit: COUNT

Statistics: SUM

CONTACTS_CONSULTED

Unit: COUNT

Statistics: SUM

CONTACTS_AGENT_HUNG_UP_FIRST

Unit: COUNT

Statistics: SUM

CONTACTS_HANDLED_INCOMING

Unit: COUNT

Statistics: SUM

CONTACTS_HANDLED_OUTBOUND

Unit: COUNT

Statistics: SUM

CONTACTS_HOLD_ABANDONS

Unit: COUNT

Statistics: SUM

CONTACTS_TRANSFERRED_IN

Unit: COUNT

Statistics: SUM

CONTACTS_TRANSFERRED_OUT

Unit: COUNT

Statistics: SUM

CONTACTS_TRANSFERRED_IN_FROM_QUEUE

Unit: COUNT

Statistics: SUM

CONTACTS_TRANSFERRED_OUT_FROM_QUEUE

Unit: COUNT

Statistics: SUM

CALLBACK_CONTACTS_HANDLED

Unit: COUNT

Statistics: SUM

CALLBACK_CONTACTS_HANDLED

Unit: COUNT

Statistics: SUM

API_CONTACTS_HANDLED

Unit: COUNT

Statistics: SUM

CONTACTS_MISSED

Unit: COUNT

Statistics: SUM

OCCUPANCY

Unit: PERCENT

Statistics: AVG

HANDLE_TIME

Unit: SECONDS

Statistics: AVG

AFTER_CONTACT_WORK_TIME

Unit: SECONDS

Statistics: AVG

QUEUED_TIME

Unit: SECONDS

Statistics: MAX

ABANDON_TIME

Unit: COUNT

Statistics: SUM

QUEUE_ANSWER_TIME

Unit: SECONDS

Statistics: AVG

HOLD_TIME

Unit: SECONDS

Statistics: AVG

INTERACTION_TIME

Unit: SECONDS

Statistics: AVG

INTERACTION_AND_HOLD_TIME

Unit: SECONDS

Statistics: AVG

SERVICE_LEVEL

Unit: PERCENT

Statistics: AVG

Threshold: Only "Less than" comparisons are supported, with the following service level thresholds: 15, 20, 25, 30, 45, 60, 90, 120, 180, 240, 300, 600

Type: Array of HistoricalMetric objects

Required: Yes

MaxResults

Indicates the maximum number of results to return per page in the response, between 1-100.

Type: Integer

Valid Range: Minimum value of 1. Maximum value of 100.

Required: No

NextToken

The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.

Type: String

Required: No

StartTime

The timestamp, in UNIX Epoch time format, at which to start the reporting interval for the retrieval of historical metrics data. The time must be specified using a multiple of 5 minutes, such as 10:05, 10:10, 10:15.

StartTime cannot be earlier than 24 hours before the time of the request. Historical metrics are available in Amazon Connect only for 24 hours.

Type: Timestamp

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "MetricResults": [ { "Collections": [ { "Metric": { "Name": "string", "Statistic": "string", "Threshold": { "Comparison": "string", "ThresholdValue": number }, "Unit": "string" }, "Value": number } ], "Dimensions": { "Channel": "string", "Queue": { "Arn": "string", "Id": "string" } } } ], "NextToken": "string" }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

MetricResults

A list of HistoricalMetricResult objects, organized by Dimensions, which is the ID of the resource specified in the Filters used for the request. The metrics are combined with the metrics included in Collections, which is a list of HisotricalMetricData objects.

If no Grouping is specified in the request, Collections includes summary data for the HistoricalMetrics.

Type: Array of HistoricalMetricResult objects

NextToken

A string returned in the response. Use the value returned in the response as the value of the NextToken in a subsequent request to retrieve the next set of results.

The token expires after 5 minutes from the time it is created. Subsequent requests that use the NextToken must use the same request parameters as the request that generated the token.

Type: String

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServiceException

Request processing failed due to an error or failure with the service.

HTTP Status Code: 500

InvalidParameterException

One or more of the parameters provided to the operation are not valid.

HTTP Status Code: 400

InvalidRequestException

The request is not valid.

HTTP Status Code: 400

ResourceNotFoundException

The specified resource was not found.

HTTP Status Code: 404

ThrottlingException

The throttling limit has been exceeded.

HTTP Status Code: 429

Example

Example granting Allow access to this operation

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "connect:GetMetricData" ], "Resource": "arn:aws:connect:us-west-2:432047966757:instance/0c7d681d-5546-4f93-97f8-0976e896dae9/queue/28915e20-4592-4f7c-8a53-a24ce6950cb5" } ] }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: