tencent cloud

文档反馈

DescribeDBInstances

最后更新时间:2023-04-06 10:21:25

1. API Description

Domain name for API request: mongodb.tencentcloudapi.com.

This API is used to query the list of TencentDB instances (which can be primary, disaster recovery, or read-only instances). It supports filtering instances by project ID, instance ID, and instance status.

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: DescribeDBInstances.
Version Yes String Common Params. The value used for this API: 2019-07-25.
Region No String Common Params. This parameter is not required for this API.
InstanceIds.N No Array of String List of instance IDs in the format of cmgo-p8vnipr5. It is the same as the instance ID displayed on the TencentDB console page.
InstanceType No Integer Instance type. Valid values:
  • 0: All instances.
  • 1: Regular instances.
  • 2: Temp instances.
  • 3: Read-only instances.
  • -1: Regular instances, read-only instances, disaster recovery instances.
ClusterType No Integer Cluster type. Valid values:
  • 0: Replica set instances.
  • 1: Sharded cluster instances.
  • -1: All instances.
Status.N No Array of Integer Instance status. Valid values:
  • 0: To be initialized.
  • 1: In process.
  • 2: Valid.
  • -2: Isolated (for monthly subscribed instances).
  • -3: Isolated (for pay-as-you-go instances).
VpcId No String VPC ID. This parameter can be left empty for the classic network.
SubnetId No String Subnet ID of VPC. This parameter can be left empty for the classic network. If it is passed in as an input parameter, the corresponding VpcId must be set.
PayMode No Integer Billing type. Valid value: 0 (pay-as-you-go)
Limit No Integer Number of results returned per request. Default value: 20. Value range: [1,100].
Offset No Integer Offset. Default value: 0.
OrderBy No String Sort by field of the returned result set. Valid values: ProjectId, InstanceName, CreateTime. The return results are sorted in ascending order by default.
OrderByType No String Sorting method of the return result set. Valid values: ASC, DESC.
ProjectIds.N No Array of Integer Project ID
SearchKey No String Search keyword, which can be instance ID, instance name, or complete IP.
Tags.N No Array of TagInfo Tag information

3. Output Parameters

Parameter Name Type Description
TotalCount Integer Number of eligible instances
InstanceDetails Array of InstanceDetail List of instance details
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Querying the list of instances

This example shows you how to query the list of instances.

Input Example

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

{
    "Status": [
        0
    ],
    "OrderBy": "xx",
    "InstanceIds": [
        "xx"
    ],
    "VpcId": "xx",
    "Tags": [
        {
            "TagKey": "xx",
            "TagValue": "xx"
        }
    ],
    "ClusterType": 0,
    "PayMode": 0,
    "Limit": 1,
    "SearchKey": "xx",
    "Offset": 1,
    "SubnetId": "xx",
    "OrderByType": "xx",
    "InstanceType": 0,
    "ProjectIds": [
        1
    ]
}

Output Example

{
    "Response": {
        "TotalCount": 1,
        "RequestId": "xx",
        "InstanceDetails": [
            {
                "ConfigServerMemory": 1,
                "Zone": "xx",
                "MongosNodeNum": 1,
                "ReadonlyInstances": [
                    {
                        "InstanceId": "xx",
                        "Region": "xx"
                    }
                ],
                "RelatedInstance": "xx",
                "AutoRenewFlag": 0,
                "DeadLine": "2020-09-22 00:00:00",
                "Memory": 1,
                "StandbyInstances": [
                    {
                        "InstanceId": "xx",
                        "Region": "xx"
                    }
                ],
                "InstanceVer": 1,
                "MaintenanceStart": "xx",
                "RealInstanceId": "xx",
                "CpuNum": 1,
                "MaintenanceEnd": "xx",
                "VpcId": "xx",
                "CloneInstances": [
                    {
                        "InstanceId": "xx",
                        "Region": "xx"
                    }
                ],
                "InstanceId": "xx",
                "ConfigServerCpuNum": 1,
                "Volume": 1,
                "SecondaryNum": 1,
                "NetType": 1,
                "MongoVersion": "xx",
                "ReplicationSetNum": 1,
                "ReplicaSets": [
                    {
                        "UsedVolume": 0.0,
                        "ReplicaSetId": "xx",
                        "Volume": 1,
                        "SecondaryNum": 1,
                        "OplogSize": 1,
                        "Memory": 1,
                        "ReplicaSetName": "xx",
                        "RealReplicaSetId": "xx"
                    }
                ],
                "InstanceType": 1,
                "Status": 1,
                "ProjectId": 1,
                "ClusterType": 1,
                "PayMode": 1,
                "SubnetId": "xx",
                "ClusterVer": 1,
                "MongosCpuNum": 1,
                "ReadonlyNodeNum": 1,
                "Protocol": 1,
                "InstanceName": "xx",
                "MongosMemory": 1,
                "MachineType": "xx",
                "InstanceStatusDesc": "xx",
                "Tags": [
                    {
                        "TagKey": "xx",
                        "TagValue": "xx"
                    }
                ],
                "UsedVolume": 1,
                "Vip": "xx",
                "ConfigServerVolume": 1,
                "Region": "xx",
                "ConfigServerNodeNum": 1,
                "Vport": 1,
                "CreateTime": "2020-09-22 00:00:00"
            }
        ]
    }
}

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.PermissionDenied The current subaccount has no permission to perform this operation.
InvalidParameterValue.IllegalInstanceStatus Invalid instance status
InvalidParameterValue.RegionError Invalid region
InvalidParameterValue.VpcIdOrSubnetIdNotFound The VPC (subnet) was not found.
InvalidParameterValue.ZoneError Invalid availability zone
UnsupportedOperation Unsupported operation
联系我们

联系我们,为您的业务提供专属服务。

技术支持

如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

7x24 电话支持