GetContactMetrics
Gets the real-time metrics of the specified contact.
Use cases
Following are common uses cases for this API:
-
You can use this API to retrieve the position of the contact in the queue.
Endpoints: See Amazon Connect endpoints and quotas.
Request Syntax
POST /metrics/contact HTTP/1.1
Content-type: application/json
{
"ContactId": "string
",
"InstanceId": "string
",
"Metrics": [
{
"Name": "string
"
}
]
}
URI Request Parameters
The request does not use any URI parameters.
Request Body
The request accepts the following data in JSON format.
- ContactId
-
The identifier of the contact in this instance of Amazon Connect.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 250.
Pattern:
^(arn:(aws|aws-us-gov):connect:[a-z]{2}-[a-z]+-[0-9]{1}:[0-9]{1,20}:instance/)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
Required: Yes
- InstanceId
-
The identifier of the Amazon Connect instance. You can find the instance ID in the Amazon Resource Name (ARN) of the instance.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 250.
Pattern:
^(arn:(aws|aws-us-gov):connect:[a-z]{2}-[a-z]+-[0-9]{1}:[0-9]{1,20}:instance/)?[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
Required: Yes
- Metrics
-
A list of contact-level metrics to retrieve.
Type: Array of ContactMetricInfo objects
Array Members: Minimum number of 1 item.
Required: Yes
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Arn": "string",
"Id": "string",
"MetricResults": [
{
"Name": "string",
"Value": { ... }
}
]
}
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.
- Arn
-
The ARN of the contact for which metrics were retrieved.
Type: String
- Id
-
The unique identifier of the contact for which metrics were retrieved.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 256.
- MetricResults
-
A list of metric results containing the calculated values for each requested metric. Each result includes the metric name and its corresponding calculated value.
Type: Array of ContactMetricResult objects
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
You do not have sufficient permissions to perform this action.
HTTP Status Code: 403
- InternalServiceException
-
Request processing failed because of an error or failure with the service.
HTTP Status Code: 500
- InvalidParameterException
-
One or more of the specified parameters 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
Examples
Sample Request
This example illustrates one usage of GetContactMetrics.
{ "InstanceId":"12345678-1234-5678-aabb-123456abcdef", "ContactId":"12345678-1234-5678-aabb-123456abcdef", "Metrics":[ { "Name": "POSITION_IN_QUEUE"} ] }
Sample Response
This example illustrates one usage of GetContactMetrics.
{ "Id":"12345678-1234-5678-aabb-123456abcdef", "Arn":"arn:aws:connect:us-east-1:123456789012:instance/12345678-1234-5678-aabb-123456abcdef/contact/12345678-1234-5678-aabb-123456abcdef", "MetricResults":[ { "Name": "POSITION_IN_QUEUE","Value":{"Number":3.0}}] }
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: