This topic describes how to call the API to obtain an overview of all tenants.
Call procedure
If you have set a password, you must perform authentication. For more information, see API hybrid encryption.
Request path
GET /api/v1/tenants/overview
Return result
| Parameter | Type | Description |
|---|---|---|
| successful | bool | Indicates whether the request was successful. |
| timestamp | time.Time | The timestamp when the server completed the request. |
| duration | int | The time (in milliseconds) required by the server to process the request. |
| status | int | The HTTP status code. |
| traceId | string | The trace ID of the request. |
| data | []DbaObTenant | The overview information of all tenants, which is described in DbaObTenant data structure. |
| error | ApiError | The error information returned in the request, which contains the following information:
|
DbaObTenant data structure:
| Parameter | Type | Description |
|---|---|---|
| tenant_id | int | The ID of the tenant. |
| tenant_name | string | The name of the tenant. |
| mode | string | The mode of the tenant. |
| status | string | The status of the tenant. |
| locked | string | Whether the tenant is locked. |
| primary_zone | string | The primary zone of the tenant. |
| locality | string | The replica information of the tenant. |
| in_recyclebin | string | Whether the tenant is in the recycle bin. |
| created_time | time.Time | The time when the tenant was created. |
Examples
Request example
GET 10.10.10.1:2886/api/v1/tenants/overview
Response example
{
"successful": true,
"timestamp": "2024-10-14T11:53:10.9102776+08:00",
"duration": 16,
"status": 200,
"traceId": "73e93b51e1600be9",
"data": {
"contents": [
{
"tenant_id": 1,
"tenant_name": "sys",
"mode": "MYSQL",
"status": "NORMAL",
"locked": "NO",
"primary_zone": "RANDOM",
"locality": "FULL{1}@zone1, FULL{1}@zone2, FULL{1}@zone3",
"in_recyclebin": "NO",
"created_time": "2024-10-14T10:24:57.999108+08:00"
},
{
"tenant_id": 1002,
"tenant_name": "t1",
"mode": "MYSQL",
"status": "NORMAL",
"locked": "NO",
"primary_zone": "RANDOM",
"locality": "FULL{1}@zone2, FULL{1}@zone3",
"in_recyclebin": "NO",
"created_time": "2024-10-14T10:26:55.086821+08:00"
}
]
}
}
References
You can also call the API by using SDK methods in addition to calling it by using the CLI.
For more information about how to call the API by using the obshell-sdk-python, see Get an overview of all tenants.
For more information about how to call the API by using the obshell-sdk-go, see Get an overview of all tenants.