百度智能云

All Product Document

          Distributed Relational Database Service DRDS

          Instructions for Database Management Interfaces

          Create a Database

          Interface description

          This interface is used to create a database under a DRDS instance.

          Request structure

          POST /v{version}/instance/{instanceId}/database?ClientToken={clientToken} HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization: authorization string
          {
              "dbName": dbName,
              "characterSetName": characterSetName,
              "remark": remark
          }

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Required Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          clientToken String Yes Query parameters Means the idempotent Token, which is an ASCII string with a length not exceeding 64 bits.
          dbName String Yes RequestBody parameter The database name consists of lowercase letters, numbers and underlines. It starts with a letter, and ends with a letter or number. The maximum length is 64 characters.
          characterSetName String Yes RequestBody parameter Means a character set, which supports only utf8 and gbk character sets currently.
          remark String No RequestBody parameter Database remarks

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          No special response parameter

          Request example

          POST https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database?clientToken=536c5bbc-a52a-42a6-a48a-c3b0cb7013c4
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de
          {
              "dbName": "dbtest",
              "characterSetName": "utf8",
              "remark": "remark"
          }

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id 7869616F-7A68-6977-656E-406261696475
          Content-Type application/json

          Delete a Database

          Interface description

          This interface is used to delete a specified database under a DRDS instance.

          Request structure

          DELETE /v{version}/instance/{instanceId}/database/{dbName} HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization authorization string

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Required Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID
          dbName String Yes URI parameter Database name

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          No special response parameter

          Request example

          DELETE https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database/dbtest
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json

          Query the database list

          Interface description

          This interface is used to query the database list under a DRDS instance.

          Request structure

          GET /v{version}/instance/{instanceId}/database HTTP/1.1
          HOST: drds.bj.baidubce.com
          Authorization: authorization string

          Request header field

          There are no other special header fields except for the common header field.

          Request parameters

          Parameter Name Type Required Parameter Position Description
          version String Yes URI parameter API version number
          instanceId String Yes URI parameter Instance ID

          Response header field

          There are no other special header fields except for the common header field.

          Response parameter

          Parameter Name Type Description
          databases List<Database> API version number

          Database

          Parameter Name Type Description
          dbname String Database name
          status String Database status
          remark String Database remarks
          characterSetName String Character set
          accountPrivileges List<PrivilegeModel> Bound account privilege

          PrivilegeModel

          Parameter Name Type Description
          accountName String Account name
          authType String Privilege type

          Request example

          GET https://drds.bj.baidubce.com/v1/instance/drdsuc6qx3cpnh3/database
          Host: drds.bj.baidubce.com
          Authorization: bce-auth-v1/f81d3b34e48048fbb2634dc7882d7e21/2015-08-11T04:17:29Z/3600/host/74c506f68c65e26c633bfa104c863fffac5190fdec1ec24b7c03eb5d67d2e1de

          Response example

          HTTP/1.1 200 OK
          x-bce-request-id: 7869616F-7A68-6977-656E-406261696475
          Content-Type: application/json
          {
              "databases": [
                  {
                      "dbName": "dbtest",
                      "status": "Available",
                      "remark": "remark",
                      "characterSetName": "utf8",
                      "accountPrivileges": [
                          {
                              "accountName": "user1",
                              "authType": "ReadOnly"
                          },
                          {
                              "accountName": "user2",
                              "authType": "ReadWrite"
                          }
                      ]
                  }
              ]
          }
          Previous
          Instructions for Data Table Management Interfaces
          Next
          Instructions for Account Management Interfaces