Overview
You can call this API to query SQL sample texts.
API details
Constraints
The caller must have an AccessKey for accessing APIs of multiple clouds. For information about how to obtain the AccessKey ID and AccessKey secret, see Manage AccessKeys.
Request path
GET api/v2/instances/{instanceId}/tenants/{tenantId}/sqls/{sqlId}/sampleSql
Request parameters
Path
| Parameter | Type | Required | Description |
|---|---|---|---|
| instanceId | String | Yes | The ID of the instance. |
| tenantId | String | Yes | The ID of the tenant. |
| sqlId | String | Yes | The ID of the SQL statement. |
Query
| Parameter | Type | Required | Description |
|---|---|---|---|
| dbName | String | No | The name of the database. |
| startTime | String | No | The start time. |
| endTime | String | No | The end time. |
| dynamicSql | Boolean | No | Specifies whether the SQL statement is dynamic. |
| limit | Integer | No | The maximum number of records to return. |
Response parameters
| Parameter | Type | Description |
|---|---|---|
| data | Object | The SQL sample texts. |
| data.dataList | Array<Object> |
The list of SQL sample texts. |
| data.dataList[].sqlText | Array |
The array of SQL sample texts. |
| data.total | Integer | The total number of records. |
| requestId | String | The ID of the request. |
| success | Boolean | Indicates whether the request was successful. |
Examples
Request example
curl --digest -u 'ak:sk' \
-X GET \
'https://api-cloud.oceanbase.com/api/v2/instances/{instanceId}/tenants/{tenantId}/sqls/{sqlId}/sampleSql' \
-G -d 'dbName=testdb' \
-d 'startTime=2025-01-01T00:00:00Z' \
-d 'endTime=2025-01-02T00:00:00Z' \
-d 'dynamicSql=false' \
-d 'limit=10'
Response example
JSON format
{
"data": {
"dataList": [
{
"sqlText": [
"SELECT * FROM in_table_0915 WHERE id IN ('1')"
]
}
],
"total": 1
},
"requestId": "136f85a2-5fac-4a0d-adf7-8735511ba28c",
"success": true
}