Description
You can call this operation to query database objects.
Call description
Prerequisites
You have passed the authentication for the OCP application service.
You have the Read permission on the specified tenant.
Request path
GET /api/v2/ob/clusters/{id}/tenants/{tenantId}/objects
Request parameters
path parameters
| Parameter | Type | Required | Example value | Description |
|---|---|---|---|---|
| id | Integer | Yes | 1 | The ID of the cluster. |
| tenantId | Integer | Yes | 5 | The ID of the tenant. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | Contents are included. |
| ├─ contents | Array | The list of database objects. For more information about the data structure of a database object, see the following table. |
| successful | Boolean | Indicates whether the request was successful. |
| timestamp | Datetime | The timestamp when the server completed the request. |
| duration | Integer | The time taken by the server to process the request, in milliseconds. |
| status | Integer | An HTTP status code. |
| traceId | String | The trace ID of the request. This trace ID is used for troubleshooting. |
| server | String | The address of the server that responded to the request. |
Data structure of a database object
| Parameter | Type | Description |
|---|---|---|
| objectType | String | The type of the database object. Valid values: * TABLE * VIEW * STORED_PROCEDURE |
| objectName | String | The name of the database object, namely, the name of the table, view, or stored procedure. |
| schemaName | String | The schema name, which is generally the same as the username. |
Examples
Sample request
Query objects in Tenant 1000001 of Cluster 1.
GET /api/v2/ob/clusters/1/tenants/2000001/objects?id=1&tenantId=2000001
Sample response
{
"data": {
"contents": [
{
"fullName": "U1.T1",
"objectName": "T1",
"objectType": "TABLE",
"schemaName": "U1"
},
{
"fullName": "U1.V1",
"objectName": "V1",
"objectType": "VIEW",
"schemaName": "U1"
},
{
"fullName": "U1.PL1",
"objectName": "PL1",
"objectType": "STORED_PROCEDURE",
"schemaName": "U1"
}
]
},
"duration": 260,
"server": "a83ad33525",
"status": 200,
"successful": true,
"timestamp": "2021-09-07T17:22:47.509+08:00",
"traceId": "b876ed597798484f"
}