1. 接口描述
接口请求域名: postgres.tencentcloudapi.com 。
本接口 (DescribeDBInstances) 用于查询一个或多个实例的详细信息。
默认接口请求频率限制:1000次/秒。
推荐使用 API Explorer
点击调试
API Explorer 提供了在线调用、签名验证、SDK 代码生成和快速检索接口等能力。您可查看每次调用的请求内容和返回结果以及自动生成 SDK 调用示例。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见 公共请求参数。
参数名称 | 必选 | 类型 | 描述 |
---|---|---|---|
Action | 是 | String | 公共参数,本接口取值:DescribeDBInstances。 |
Version | 是 | String | 公共参数,本接口取值:2017-03-12。 |
Region | 是 | String | 公共参数,详见产品支持的 地域列表。 |
Filters.N | 否 | Array of Filter | 按照一个或者多个过滤条件进行查询,目前支持的过滤条件有: db-instance-id:按照实例ID过滤,类型为string db-instance-name:按照实例名过滤,类型为string db-project-id:按照项目ID过滤,类型为integer db-pay-mode:按照实例付费模式过滤,类型为string db-tag-key:按照标签键过滤,类型为string db-private-ip: 按照实例私有网络IP过滤,类型为string db-public-address: 按照实例外网地址过滤,类型为string db-dedicated-cluster-id: 按照私有集群Id过滤,类型为string 示例值:[ { "Values": [ "postgres-xxxxxxxx" ], "Name": "db-instance-id" } ] |
Limit | 否 | Integer | 每页显示数量,取值范围为1-100,默认为返回10条。 示例值:10 |
Offset | 否 | Integer | 数据偏移量,从0开始。 示例值:0 |
OrderBy | 否 | String | 排序指标,如实例名、创建时间等,支持DBInstanceId,CreateTime,Name,EndTime 示例值:CreateTime |
OrderByType | 否 | String | 排序方式,包括升序:asc、降序:desc。 示例值:desc |
3. 输出参数
参数名称 | 类型 | 描述 |
---|---|---|
TotalCount | Integer | 查询到的实例数量。 示例值:1 |
DBInstanceSet | Array of DBInstance | 实例详细信息集合。 示例值:[ { "DBInstanceId": "postgres-xxxxxxxx", "DBInstanceName": "xxx", "DBInstanceStatus": "running", "Region": "ap-guangzhou", "Zone": "ap-guangzhou-3", "ProjectId": 0, "VpcId": "vpc-xxxxxxxx", "SubnetId": "subnet-xxxxxxxx", "DBCharset": "UTF8", "DBVersion": "10", "DBKernelVersion": "v10.4_r1.0", "CreateTime": "2020-03-20 12:19:14", "DBInstanceNetInfo": [ { "Address": "", "Ip": "10.10.10.111", "Port": 5432, "Status": "opened", "NetType": "private" }, { "Address": "", "Ip": "", "Port": 0, "Status": "initing", "NetType": "public" } ], "DBAccountSet": [], "DBDatabaseList": null } ] |
RequestId | String | 唯一请求 ID,由服务端生成,每次请求都会返回(若请求因其他原因未能抵达服务端,则该次请求不会获得 RequestId)。定位问题时需要提供该次请求的 RequestId。 |
4. 示例
示例1 查询所有实例列表
按指定分页查询实例列表
输入示例
POST / HTTP/1.1
Host: postgres.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeDBInstances
<公共请求参数>
{
"Limit": "10",
"Offset": "0"
}
输出示例
{
"Response": {
"TotalCount": 1,
"DBInstanceSet": [
{
"AppId": 123456789,
"AutoRenew": 1,
"CreateTime": "2022-03-16 18:12:10",
"DBCharset": "UTF8",
"DBEngine": "postgresql",
"DBEngineConfig": "",
"DBInstanceClass": "cdb.pg.ts1.8g",
"DBInstanceCpu": 4,
"DBInstanceId": "postgres-xxxxxx",
"DBInstanceMemory": 8,
"DBInstanceName": "test",
"DBInstanceNetInfo": [
{
"Address": "",
"Ip": "xx.xx.xx.xx",
"NetType": "private",
"Port": 5432,
"ProtocolType": "postgresql",
"Status": "opened",
"SubnetId": "subnet-xxxx",
"VpcId": "vpc-xxxx"
},
{
"Address": "",
"Ip": "",
"NetType": "public",
"Port": 0,
"ProtocolType": "",
"Status": "initing",
"SubnetId": "",
"VpcId": ""
}
],
"DBInstanceStatus": "running",
"DBInstanceStorage": 20,
"DBInstanceType": "primary",
"DBInstanceVersion": "standard",
"DBKernelVersion": "v13.3_r1.1",
"DBMajorVersion": "13",
"DBNodeSet": [
{
"Role": "Primary",
"Zone": "ap-guangzhou-6",
"DedicatedClusterId": ""
},
{
"Role": "Standby",
"Zone": "ap-guangzhou-6",
"DedicatedClusterId": ""
}
],
"DBVersion": "13.3",
"ExpireTime": "2023-04-16 18:14:49",
"IsSupportTDE": 0,
"IsolatedTime": "0000-00-00 00:00:00",
"MasterDBInstanceId": "",
"NetworkAccessList": null,
"OfflineTime": "0001-01-08 00:00:00",
"PayType": "prepaid",
"ProjectId": 0,
"ReadOnlyInstanceNum": 0,
"Region": "ap-guangzhou",
"StatusInReadonlyGroup": "",
"SubnetId": "subnet-xxxx",
"SupportIpv6": 0,
"TagList": [
{
"TagKey": "tag_key_test",
"TagValue": "tag_value_test"
}
],
"Type": "TS85",
"Uid": 1234,
"UpdateTime": "2023-03-15 17:31:58",
"VpcId": "vpc-xxxx",
"Zone": "ap-guangzhou-6"
}
],
"RequestId": "d849664a-191c-48bf-b42f-444caa189557"
}
}
示例2 根据实例ID查询实例信息
例如:查询实例ID为postgres-xxxxx的实例信息
输入示例
POST / HTTP/1.1
Host: postgres.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: DescribeDBInstances
<公共请求参数>
{
"Limit": "10",
"Filters": [
{
"Values": [
"postgres-xxxxx"
],
"Name": "db-instance-id"
}
],
"Offset": "0"
}
输出示例
{
"Response": {
"TotalCount": 1,
"DBInstanceSet": [
{
"AppId": 123456789,
"AutoRenew": 1,
"CreateTime": "2022-03-16 18:12:10",
"DBCharset": "UTF8",
"DBEngine": "postgresql",
"DBEngineConfig": "",
"DBInstanceClass": "cdb.pg.ts1.8g",
"DBInstanceCpu": 4,
"DBInstanceId": "postgres-xxxxx",
"DBInstanceMemory": 8,
"DBInstanceName": "test",
"DBInstanceNetInfo": [
{
"Address": "",
"Ip": "xx.xx.xx.xx",
"NetType": "private",
"Port": 5432,
"ProtocolType": "postgresql",
"Status": "opened",
"SubnetId": "subnet-xxxx",
"VpcId": "vpc-xxxx"
},
{
"Address": "",
"Ip": "",
"NetType": "public",
"Port": 0,
"ProtocolType": "",
"Status": "initing",
"SubnetId": "",
"VpcId": ""
}
],
"DBInstanceStatus": "running",
"DBInstanceStorage": 20,
"DBInstanceType": "primary",
"DBInstanceVersion": "standard",
"DBKernelVersion": "v13.3_r1.1",
"DBMajorVersion": "13",
"DBNodeSet": [
{
"Role": "Primary",
"Zone": "ap-guangzhou-6",
"DedicatedClusterId": ""
},
{
"Role": "Standby",
"Zone": "ap-guangzhou-6",
"DedicatedClusterId": ""
}
],
"DBVersion": "13.3",
"ExpireTime": "2023-04-16 18:14:49",
"IsSupportTDE": 0,
"IsolatedTime": "0000-00-00 00:00:00",
"MasterDBInstanceId": "",
"NetworkAccessList": null,
"OfflineTime": "0001-01-08 00:00:00",
"PayType": "prepaid",
"ProjectId": 0,
"ReadOnlyInstanceNum": 0,
"Region": "ap-guangzhou",
"StatusInReadonlyGroup": "",
"SubnetId": "subnet-xxxx",
"SupportIpv6": 0,
"TagList": [
{
"TagKey": "tag_key_test",
"TagValue": "tag_value_test"
}
],
"Type": "TS85",
"Uid": 1234,
"UpdateTime": "2023-03-15 17:31:58",
"VpcId": "vpc-xxxx",
"Zone": "ap-guangzhou-6"
}
],
"RequestId": "d849664a-191c-48bf-b42f-444caa189557"
}
}
5. 开发者资源
腾讯云 API 平台
腾讯云 API 平台 是综合 API 文档、错误码、API Explorer 及 SDK 等资源的统一查询平台,方便您从同一入口查询及使用腾讯云提供的所有 API 服务。
API Inspector
用户可通过 API Inspector 查看控制台每一步操作关联的 API 调用情况,并自动生成各语言版本的 API 代码,也可前往 API Explorer 进行在线调试。
SDK
云 API 3.0 提供了配套的开发工具集(SDK),支持多种编程语言,能更方便的调用 API。
- Tencent Cloud SDK 3.0 for Python: GitHub Gitee
- Tencent Cloud SDK 3.0 for Java: GitHub Gitee
- Tencent Cloud SDK 3.0 for PHP: GitHub Gitee
- Tencent Cloud SDK 3.0 for Go: GitHub Gitee
- Tencent Cloud SDK 3.0 for Node.js: GitHub Gitee
- Tencent Cloud SDK 3.0 for .NET: GitHub Gitee
- Tencent Cloud SDK 3.0 for C++: GitHub Gitee
- Tencent Cloud SDK 3.0 for Ruby: GitHub Gitee
命令行工具
6. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见 公共错误码。
错误码 | 描述 |
---|---|
AuthFailure.UnauthorizedOperation | 鉴权失败。 |
FailedOperation.CamCheckResourceError | 获取权限失败,请稍后重试。如果持续不成功,请联系客服进行处理。。 |
FailedOperation.CamCheckResourceFailed | CAM资源检查失败。 |
FailedOperation.CamSigAndAuthError | 鉴权失败,请稍后重试。如果持续不成功,请联系客服进行处理。 |
FailedOperation.DatabaseAccessError | 管控元数据库访问失败,请稍后重试。如果持续不成功,请联系客服进行处理。 |
FailedOperation.DatabaseAffectedError | 数据操作失败,请联系客服进行处理。 |
FailedOperation.FailedOperationError | 操作失败,请稍后重试。 |
FailedOperation.LimitOperation | 实例被限制操作。 |
FailedOperation.OssAccessError | 访问管控服务失败,请稍后重试。如果持续不成功,请联系客服进行处理。 |
InternalError.DBError | 后台DB执行错误。 |
InternalError.InternalHttpServerError | 请求执行异常。 |
InternalError.SystemError | 系统错误。出现这种错误时,请联系客服支持。 |
InternalError.TransactioBeginError | 开启事务失败。 |
InternalError.UnknownError | 其他未知错误。出现这种错误时,请联系客服支持。 |
InvalidParameter | 参数错误。 |
InvalidParameterValue.DataConvertError | 数据格式转换失败,请联系客服处理。 |
InvalidParameterValue.IllegalRegion | 非法的Region参数。 |
InvalidParameterValue.InstanceNotExist | 当前实例不存在。 |
InvalidParameterValue.InvalidParameterValueError | 参数值有误。 |
InvalidParameterValue.InvalidRegionIdError | 无效地域。 |
InvalidParameterValue.ParameterHandleError | 参数处理失败,请检参数值设置是否有效。 |
InvalidParameterValue.RegionNotSupported | 不支持当前地域。 |
InvalidParameterValue.StructParseFailed | 解析参数出错。 |
OperationDenied.CamDeniedError | 当前操作被限制。 |
ResourceNotFound.InstanceNotFoundError | 实例不存在。 |
ResourceUnavailable.InvalidInstanceStatus | 实例状态错误。 |
UnsupportedOperation | 操作不支持。 |