Domain name for API request: asr.intl.tencentcloudapi.com.
The recognition results can be obtained through callback or polling after the recording recognition request API is called.
A maximum of 50 requests can be initiated per second for this API.
The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.
Parameter Name | Required | Type | Description |
---|---|---|---|
Action | Yes | String | Common Params. The value used for this API: DescribeTaskStatus. |
Version | Yes | String | Common Params. The value used for this API: 2019-06-14. |
Region | No | String | Common Params. This parameter is not required. |
TaskId | Yes | Integer | Task ID obtained from the CreateRecTask API, which is used to obtain the task status and results. ** Note: A task is valid for 24 hours. Do not query the results with the tasks that have existed for more than 24 hours. ** |
Parameter Name | Type | Description |
---|---|---|
Data | TaskStatus | Returned result of the recording recognition request. |
RequestId | String | The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. |
Retrieve the recognition result through polling. The task fails. You can check the value of ErrorMsg in the returned result for the failure cause.
POST / HTTP/1.1
Host: asr.intl.tencentcloudapi.com
Content-Type: application/json; charset=utf-8
X-TC-Version: 2019-06-14
X-TC-Region: ap-shanghai
X-TC-Action: DescribeTaskStatus
X-TC-Timestamp: 1599142563
Authorization: TC3-HMAC-SHA256 Credential=xxx/2020-09-03/asr/tc3_request, SignedHeaders=content-type;host, Signature=6647fa852c9329ac5aa355c68c838358139c2d941f4ed175dd5858978f5d79c8
Content-Length: 21
<Common request parameters>
{
"TaskId": 522931820
}
{
"Response": {
"RequestId": "8824366f-0e8f-4bd4-8924-af5e84127caa",
"Data": {
"TaskId": 522931820,
"Status": 3,
"StatusStr": "failed",
"AudioDuration": 0,
"Result": "",
"ErrorMsg": "Failed to download audio file!",
"ResultDetail": []
}
}
}
Retrieve the recognition result through polling. The task is successful, and the recognition result is returned.
POST / HTTP/1.1
Host: asr.intl.tencentcloudapi.com
Content-Type: application/json; charset=utf-8
X-TC-Version: 2019-06-14
X-TC-Region: ap-shanghai
X-TC-Action: DescribeTaskStatus
X-TC-Timestamp: 1599142563
Authorization: TC3-HMAC-SHA256 Credential=xxx/2020-09-03/asr/tc3_request, SignedHeaders=content-type;host, Signature=6647fa852c9329ac5aa355c68c838358139c2d941f4ed175dd5858978f5d79c8
Content-Length: 21
<Common request parameters>
{
"TaskId": 522931820
}
{
"Response": {
"RequestId": "a73b14a6-5044-41cb-bf32-e735d5bd69de",
"Data": {
"TaskId": 9266418,
"Status": 2,
"StatusStr": "success",
"AudioDuration": 2.38,
"Result": "[0:0.020,0:2.380] Welcome to Tencent Cloud ASR,\n",
"ResultDetail": [
{
"FinalSentence": "Welcome to Tencent Cloud ASR,",
"SliceSentence": "Welcome to Tencent Cloud ASR,",
"StartMs": 20,
"EndMs": 2380,
"SpeechSpeed": 5.9,
"WordsNum": 4,
"EmotionalEnergy": 0,
"SpeakerId": 0,
"SilenceTime": 0,
"EmotionType": [
"happy"
],
"Words": [
{
"OffsetStartMs": 120,
"OffsetEndMs": 780,
"Word": "Tencent Cloud"
},
{
"OffsetStartMs": 780,
"OffsetEndMs": 1530,
"Word": "ASR"
},
{
"OffsetStartMs": 1530,
"OffsetEndMs": 1860,
"Word": "Welcome to"
},
{
"OffsetStartMs": 1860,
"OffsetEndMs": 2250,
"Word": " "
}
],
}
],
"ErrorMsg": ""
}
}
}
Retrieve the recognition result through polling. The task is waiting, which means that the task is still in the queue. You need to wait patiently.
POST / HTTP/1.1
Host: asr.intl.tencentcloudapi.com
Content-Type: application/json; charset=utf-8
X-TC-Version: 2019-06-14
X-TC-Region: ap-shanghai
X-TC-Action: DescribeTaskStatus
X-TC-Timestamp: 1599142563
Authorization: TC3-HMAC-SHA256 Credential=xxx/2020-09-03/asr/tc3_request, SignedHeaders=content-type;host, Signature=6647fa852c9329ac5aa355c68c838358139c2d941f4ed175dd5858978f5d79c8
Content-Length: 21
<Common request parameters>
{
"TaskId": 522931820
}
{
"Response": {
"RequestId": "8824366f-0e8f-4bd4-8924-af5e84127caa",
"Data": {
"TaskId": 522931820,
"Status": 0,
"StatusStr": "waiting",
"AudioDuration": 0,
"Result": "",
"ErrorMsg": "",
"ResultDetail": []
}
}
}
Retrieve the recognition result through polling. The task is in progress, which means that recognition has started. You need to wait patiently.
POST / HTTP/1.1
Host: asr.intl.tencentcloudapi.com
Content-Type: application/json; charset=utf-8
X-TC-Version: 2019-06-14
X-TC-Region: ap-shanghai
X-TC-Action: DescribeTaskStatus
X-TC-Timestamp: 1599142563
Authorization: TC3-HMAC-SHA256 Credential=xxx/2020-09-03/asr/tc3_request, SignedHeaders=content-type;host, Signature=6647fa852c9329ac5aa355c68c838358139c2d941f4ed175dd5858978f5d79c8
Content-Length: 21
<Common request parameters>
{
"TaskId": 522931820
}
{
"Response": {
"RequestId": "8824366f-0e8f-4bd4-8924-af5e84127caa",
"Data": {
"TaskId": 522931820,
"Status": 1,
"StatusStr": "doing",
"AudioDuration": 0,
"Result": "",
"ErrorMsg": "",
"ResultDetail": []
}
}
}
TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.
The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.
Error Code | Description |
---|---|
FailedOperation.ErrorDownFile | Failed to download the audio file. |
FailedOperation.ErrorRecognize | Recognition failed. |
FailedOperation.NoSuchTask | Incorrect task ID. |
FailedOperation.ServiceIsolate | Services are stopped due to overdue payments. Top up your Tencent Cloud account first. |
FailedOperation.UserHasNoFreeAmount | The resource package is used up. Enable post-payment or purchase a new resource package. |
InternalError.FailAccessDatabase | Failed to access the database. |
InternalError.FailAccessRedis | Failed to access Redis. |
InvalidParameter | Parameter error. |
MissingParameter | Parameters are missing |
UnknownParameter | Unknown parameter. |
本页内容是否解决了您的问题?