Help Center/ Distributed Database Middleware/ API Reference/ APIs (Recommended)/ Schemas/ Querying DB Instances Available for Creating a Schema
Updated on 2024-08-02 GMT+08:00

Querying DB Instances Available for Creating a Schema

Function

This API is used to query DB instances that can be used for creating a schema.

Constraints

None

URI

GET /v1/{project_id}/instances/{instance_id}/rds?offset={offset}&limit={limit}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region

To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

DDM instance ID

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Index offset.

The query starts from the next piece of data indexed by this parameter. The value is 0 by default.

The value must be a positive integer.

limit

No

Integer

Maximum instances to be queried.

Value range: 1 to 128.

If the parameter value is not specified, 10 schemas are queried by default.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

You can obtain the token by calling the IAM API used to obtain a user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

instances

Array of QueryAvailableRdsList objects

DB instances that can be used for creating a schema

offset

Integer

Which page the server starts returning items

limit

Integer

Number of records displayed on each page

total

Integer

Total collections

Table 5 QueryAvailableRdsList

Parameter

Type

Description

id

String

DB instance ID

projectId

String

Project ID of the tenant that the DB instance belongs to

status

String

DB instance status

name

String

DB instance name

engineName

String

Engine name of the DB instance

engineSoftwareVersion

String

Engine version of the DB instance

privateIp

String

Private IP address for connecting to the DB instance

mode

String

DB instance type (primary/standby or single-node)

port

Integer

Port for connecting to the DB instance

azCode

String

AZ

timeZone

String

Time zone

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

errCode

String

Service error code

externalMessage

String

Error message

Status code: 500

Table 7 Response body parameters

Parameter

Type

Description

errCode

String

Service error code

externalMessage

String

Error message

Example Request

Querying DB instances available for creating a schema

GET https://{endpoint}/v1/{project_id}/instances/{instance_id}/rds?offset={offset}&limit={limit}

Example Response

Status code: 200

OK

{
  "instances" : [ {
    "id" : "c6f68fed9e74478c8679479a07d7d568in01",
    "projectId" : "055d9f4ee780d4d42f96c01c1bc3c50c",
    "status" : "normal",
    "name" : "test-ddm-no-delete-test01-00",
    "engineName" : "mysql",
    "engineSoftwareVersion" : 5.7,
    "privateIp" : "192.168.23.97",
    "mode" : "Ha",
    "port" : 3306,
    "azCode" : "az1xahzaz1xahz",
    "timeZone" : "UTC+08: 00"
  }, {
    "id" : "337e2598c2a64cb5935079f85996731din01",
    "projectId" : "055d9f4ee780d4d42f96c01c1bc3c50c",
    "status" : "normal",
    "name" : "test-ddm-no-delete-test01",
    "engineName" : "mysql",
    "engineSoftwareVersion" : 5.7,
    "privateIp" : "192.168.23.221",
    "mode" : "Ha",
    "port" : 3306,
    "azCode" : "az1xahzaz1xahz",
    "timeZone" : "UTC+08: 00"
  } ],
  "offset" : 0,
  "limit" : 6,
  "total" : 2
}

Status code: 400

bad request

{
  "externalMessage" : "Parameter error.",
  "errCode" : "DBS.280001"
}

Status code: 500

server error

{
  "externalMessage" : "Server failure.",
  "errCode" : "DBS.200412"
}

Status Codes

Status Code

Description

200

OK

400

bad request

500

server error

Error Codes

For details, see Error Codes.