DescribeDBInstances

Last updated: 2020-03-04 23:47:08

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 master, 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.

Note: This API supports Finance regions. If the common parameter Region is a Finance region, a domain name with the Finance region needs to be specified, for example: mongodb.ap-shanghai-fsi.tencentcloudapi.com

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 parameter. The value used for this API: DescribeDBInstances.
Version Yes String Common parameter. The value used for this API: 2019-07-25.
Region Yes String Common parameter. For more information, please see the list of regions supported by the product.
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 (promoted), 2 (temp), 3 (read-only), -1 (promoted + read-only + disaster recovery)
ClusterType No Integer Cluster type. Valid values: 0 (replica set instance), 1 (sharding instance), -1 (all instances)
Status.N No Array of Integer Instance status. Valid values: 0 (to be initialized), 1 (in process), 2 (valid), -2 (expired)
VpcId No String VPC ID. This parameter can be left empty for the basic network
SubnetId No String Subnet ID of VPC. This parameter can be left empty for the basic 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 to be returned for a single request. Valid values: 1–100. Default value: 20
Offset No Integer Offset. Default value: 0
OrderBy No String Sort by field of the returned result set. Currently, supported values include "ProjectId", "InstanceName", and "CreateTime". The return results are sorted in ascending order by default.
OrderByType No String Sorting method of the return result set. Currently, "ASC" or "DESC" is supported
ProjectIds.N No Array of Integer Project ID
SearchKey No String Search keyword, which can be instance ID, instance name, or complete IP

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 Query the instance list

Input Example

https://mongodb.tencentcloudapi.com/?Action=DescribeDBInstances
&Limit=1
&<common request parameters>

Output Example

{
  "Response": {
    "InstanceDetails": [
      {
        "AutoRenewFlag": 0,
        "CloneInstances": [],
        "ClusterType": 0,
        "ClusterVer": 1,
        "CpuNum": 2,
        "CreateTime": "2019-04-02 19:29:16",
        "DeadLine": "2019-04-04 19:29:16",
        "InstanceId": "cmgo-rw2v134z",
        "InstanceName": "cmgo-rw2v134z",
        "InstanceStatusDesc": "rolling back",
        "InstanceType": 2,
        "InstanceVer": 4,
        "MachineType": "HIO10G",
        "MaintenanceEnd": "05:00:00",
        "MaintenanceStart": "04:00:00",
        "Memory": 4096,
        "MongoVersion": "MONGO_3_WT",
        "NetType": 1,
        "PayMode": 0,
        "ProjectId": 0,
        "Protocol": 0,
        "ReadonlyInstances": [],
        "RealInstanceId": "cmgo-da0pc0dr",
        "Region": "ap-guangzhou",
        "RelatedInstance": {
          "InstanceId": "",
          "Region": ""
        },
        "ReplicaSets": [
          {
            "Memory": 4096,
            "OplogSize": 10240,
            "RealReplicaSetId": "cmgo-rw2v134z_0",
            "ReplicaSetId": "cmgo-rw2v134z_0",
            "ReplicaSetName": "cmgo-rw2v134z_0",
            "SecondaryNum": 2,
            "UsedVolume": 0,
            "Volume": 102400
          }
        ],
        "ReplicationSetNum": 1,
        "SecondaryNum": 2,
        "StandbyInstances": [],
        "Status": 1,
        "SubnetId": "subnet-b0lagkxi",
        "Tags": [],
        "UsedVolume": 0,
        "Vip": "",
        "Volume": 102400,
        "VpcId": "vpc-orgohlut",
        "Vport": 27017,
        "Zone": "ap-guangzhou-3"
      }
    ],
    "RequestId": "302530d2-ee57-495e-89d0-51e03b11815e",
    "TotalCount": 19
  }
}

5. Developer Resources

API Explorer

This tool allows online call, signature authentication, SDK code generation and quick search of APIs to greatly improve the efficiency of using TencentCloud APIs.

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 AZ.