Updated on 2022-09-15 GMT+08:00

Querying Schemas

Function

This API is used to query schemas of a DDM instance.

Constraints

None

URI

GET /v1/{project_id}/instances/{instance_id}/databases

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

instance_id

Yes

String

DDM instance ID

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

Integer

Which page the server starts returning items. The start value cannot be less than 0. The default value is 0.

Minimum value: 0

limit

No

Integer

Number of records displayed on each page. The value is greater than 0 and not greater than 128. The default value is 128.

Minimum value: 1

Maximum value: 128

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

databases

Array of GetDatabaseInfo objects

Schema information

total

Integer

Total records

Table 5 GetDatabaseInfo

Parameter

Type

Description

name

String

Schema name

shard_mode

String

Sharding mode of the schema

  • cluster: indicates that the schema is in sharded mode.
  • single: indicates that the schema is in unsharded mode.

shard_number

Integer

Number of shards in the same working mode

status

String

Schema status

created

String

Time when the schema is created

used_rds

Array of GetDatabaseUsedRds objects

RDS instances associated with the schema

shard_unit

Integer

Number of shards per RDS instance

Table 6 GetDatabaseUsedRds

Parameter

Type

Description

id

String

Node ID of the associated RDS instance

name

String

Name of the associated RDS instance

status

String

Status of the associated RDS instance

error_msg

String

Response message. This parameter is not returned if no abnormality occurs.

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

errCode

String

Service error code

externalMessage

String

Error message

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

errCode

String

Service error code

externalMessage

String

Error message

Example Request

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

Example Response

Status code: 200

OK

{
  "databases" : [ {
    "status" : "RUNNING,",
    "created" : "1642063713625,",
    "name" : "mytestdb170,",
    "shard_mode" : "cluster,",
    "shard_number" : "8,",
    "shard_unit" : "8,",
    "used_rds" : [ {
      "id" : "c6f68fed9e74478c8679479a07d7d568in01",
      "status" : "normal",
      "name" : "rds-test"
    } ]
  } ],
  "total" : 172
}

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.