tencent cloud

DescribeHASwitchLog
Last updated: 2025-10-28 22:49:05
DescribeHASwitchLog
Last updated: 2025-10-28 22:49:05

1. API Description

Domain name for API request: sqlserver.intl.tencentcloudapi.com.

This API is used to perform the manual primary-secondary switch.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

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: DescribeHASwitchLog.
Version Yes String Common Params. The value used for this API: 2018-03-28.
Region Yes String Common Params. For more information, please see the list of regions supported by the product. This API only supports: ap-bangkok, ap-beijing, ap-chengdu, ap-chongqing, ap-guangzhou, ap-hongkong, ap-jakarta, ap-nanjing, ap-seoul, ap-shanghai, ap-shanghai-fsi, ap-shenzhen-fsi, ap-singapore, ap-tokyo, eu-frankfurt, na-ashburn, na-siliconvalley, sa-saopaulo.
InstanceId Yes String Instance ID.
StartTime Yes String Start time (yyyy-MM-dd HH:mm:ss).
EndTime Yes String End time (yyyy-MM-dd HH:mm:ss).
SwitchType No Integer Switch mode. 0 - system automatic switch; 1 - manual switch. Check all switch modes by default if the parameter is left unspecified.
Limit No Integer Pagination size.
Offset No Integer Pagination number.

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Total number of logs.
SwitchLog Array of SwitchLog Primary-secondary switch logs.
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.

4. Example

Example1 Querying Primary-Secondary Switch Logs

Input Example

POST / HTTP/1.1
Host: sqlserver.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: SwitchCloudInstanceHA
<Common request parameters>

{
    "InstanceId": "mssql-98aiauan",
    "SwitchType": 1,
    "StartTime": "2023-01-01 00:00:00",
    "EndTime": "2023-01-01 00:01:00",
    "Limit": 10,
    "Offset": 0
}

Output Example

{
    "Response": {
        "RequestId": "863b2797-858b-49f3-88e9-50159e564cbc",
        "TotalCount": 1,
        "SwitchLog": [
            {
                "EventId": "f39bc24b76d1c5d3ce60f0dcb9e0bd79",
                "SwitchType": 1,
                "StartTime": "2023-01-01 00:00:00",
                "EndTime": "2023-01-01 00:01:00",
                "Reason": "AUTO"
            }
        ]
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InvalidParameter.InputIllegal Input error.
UnauthorizedOperation.PermissionDenied CAM authentication error.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback