Initiates an SQL statement diagnostics request on an instance connected to DAS.
Before you call this operation, make sure that the following requirements are met:
- If you use an SDK to call DAS, you must set the region to cn-shanghai.
- This operation can be used in the following database services:
- RDS MySQL
- RDS PostgreSQL
- RDS SQL Server
- PolarDB for MySQL
- PolarDB for PostgreSQL(Compatible with Oracle)
- ApsaraDB for MongoDB
Note The minor engine version of an RDS for PostgreSQL instance is 20220130 or later. For more information, see Update the minor engine version of an RDS for PostgreSQL instance.
Request parameters
| Parameter | Type | Required | Example | Description |
|---|---|---|---|---|
| Action | String | Yes | CreateRequestDiagnosis | The operation that you want to perform. Set the value to CreateRequestDiagnosis. |
| InstanceId | String | Yes | rm-0iwhhl8gx0ld6**** | The ID of the instance. |
| NodeId | String | No | 202**** | The ID of the node. Note This parameter must be specified for cluster instances such as PolarDB for MySQL, PolarDB for PostgreSQL(Compatible with Oracle), and ApsaraDB for MongoDB. |
| Database | String | Yes | das | The name of the database. |
| Sql | String | Yes | select * from test where name = 'mockUser' | The SQL statement to be diagnosed. |
Response parameters
| Parameter | Type | Example | Description |
|---|---|---|---|
| Code | String | 200 | The returned HTTP status code. |
| Message | String | Successful | The returned message. Note If the request is successful, Successful is returned. If the request fails, an error message that contains information such as an error code is returned. |
| Data | String | 61820b594664275c4429**** | The unique ID of the diagnostic task. It is used to query the diagnosis result later. |
| RequestId | String | 800FBAF5-A539-5B97-A09E-C63AB2F7**** | The ID of the request. |
| Success | String | true | Indicates whether the request is successful. Valid values:
|
Examples
Sample requests
http(s)://das.cn-shanghai.aliyuncs.com/?Action=CreateRequestDiagnosis
&InstanceId=rm-0iwhhl8gx0ld6****
&NodeId=202****
&Database=das
&Sql=select * from test where name = 'mockUser'
&Common request parametersSample success responses
XML format
HTTP/1.1 200 OK
Content-Type:application/xml
<CreateRequestDiagnosisResponse>
<Code>200</Code>
<Message>Successful</Message>
<Data>61820b594664275c4429****</Data>
<RequestId>800FBAF5-A539-5B97-A09E-C63AB2F7****</RequestId>
<Success>true</Success>
</CreateRequestDiagnosisResponse>JSON format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Code" : "200",
"Message" : "Successful",
"Data" : "61820b594664275c4429****",
"RequestId" : "800FBAF5-A539-5B97-A09E-C63AB2F7****",
"Success" : "true"
}Error codes
| HttpCode | Error code | Error message | Description |
|---|---|---|---|
| 400 | InvalidParams | The request parameters are invalid. | The error message returned because the specified request parameters are invalid. |
For a list of error codes, visit the API Error Center.