Queries the database links of a PolarDB-O cluster.

Note You can query only the database links that use a PolarDB-O cluster as the source cluster.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String No DescribeDBLinks

The operation that you want to perform. Set the value to DescribeDBLinks.

DBClusterId String Yes pc-a*************

The ID of the cluster for which you want to query the database links.

Note You can call the DescribeDBClusters operation to query PolarDB clusters.
DBLinkName String No dblink_test

The name of the database link. If you leave this parameter empty, the system returns all the database links.

Response parameters

Parameter Type Example Description
DBInstanceName String pc-a*************

The ID of the cluster.

DBLinkInfos Array of DBLinkInfos

The information set of the database link.

DBInstanceName String pc-a*************

The ID of the source cluster that the database link connects.

DBLinkName String dblink_test

The name of the database link.

SourceDBName String testdb1

The name of the source database of the database link.

TargetAccount String testacc

The account of the destination database of the database link.

TargetDBInstanceName String pc-b************

The ID of the destination cluster that the database link connects.

Note If the destination cluster is not a PolarDB-O cluster, the returned value is empty.
TargetDBName String testdb2

The name of the destination database of the database link.

RequestId String 45D24263-7E3A-4140-9472-************

The ID of the request.

Examples

Sample requests

http(s)://polardb.aliyuncs.com/? Action=DescribeDBLinks
&DBClusterId=pc-*************
&<Common request parameters>

Sample success responses

XML format

<DescribeDBLinksResponse>
      <RequestId>45D24263-7E3A-4140-9472-7C1BE3B1F19A</RequestId>
      <DBLinkInfos>
            <SourceDBName>testdb1</SourceDBName>
            <TargetDBName>testdb2</TargetDBName>
            <TargetAccount>testacc</TargetAccount>
            <TargetDBInstanceName>pc-b************</TargetDBInstanceName>
            <DBInstanceName>pc-a*************</DBInstanceName>
            <DBLinkName>dblink_test</DBLinkName>
      </DBLinkInfos>
</DescribeDBLinksResponse>

JSON format

{
	"RequestId": "45D24263-7E3A-4140-9472-7C1BE3B1F19A",
	"DBLinkInfos": [
		{
			"SourceDBName": "testdb1",
			"TargetDBName": "testdb2",
			"TargetAccount": "testacc",
			"TargetDBInstanceName": "pc-b************",
			"DBInstanceName": "pc-a*************",
			"DBLinkName": "dblink_test"
		}
	]
}

Error codes

For a list of error codes, visit the API Error Center.