Asynchronously queries information of up to 20 failed SQL queries from SQL Explorer data.

Note The complete query results are not returned immediately after an asynchronous call is made. If the value of isFinish is false in the response, wait for 1 second and then re-initiate the call. The complete query results are returned until the value of isFinish is true.
  • This API operation supports only ApsaraDB RDS for MySQL and PolarDB for MySQL database instances for which DAS Professional Edition is enabled. For more information, see Purchase DAS Professional Edition.
  • If you use an SDK to call the DAS service, you must set the region to cn-shanghai.

Request parameters

Parameter Type Required Example Description
Action String Yes GetErrorRequestSample

The operation that you want to perform. Set the value to GetErrorRequestSample.

InstanceId String Yes rm-2ze8g2am97624****

The instance ID.

NodeId String No pi-bp179lg03445l****

The node ID.

Note This parameter is required for PolarDB for MySQL clusters.
SqlId String No 2cd4432556c3dab9d825ba363637****

The ID of the SQL query. You can call the GetAsyncErrorRequestListByCode operation to query the ID of the SQL query for which MySQL error code is returned.

Start Long No 1642556990714

The beginning of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

Note The start time can be up to 90 days earlier than the current time.
End Long No 1642566830000

The end of the time range to query. Specify the time in the UNIX timestamp format. Unit: milliseconds.

Note The end time must be later than the start time. The interval cannot exceed 24 hours.
DbName String No testdb01

The name of the database.

Response parameters

Parameter Type Example Description
Code Long 200

The returned HTTP status code.

Message String Successful

The message that is returned for the request.

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 Array of sample

The returned data.

sqlId String 2cd4432556c3dab9d825ba363637****

The ID of the SQL query.

database String dbgateway

The name of the database.

originHost String 172.16.1****

The IP address of the client that executes the SQL statement.

tables Array of String meter_****

The name of the table.

instanceId String rm-2ze8g2am97624****

The ID of the instance.

errorCode String 1062

The error code.

user String dbgat****

The username of the account that is used to log on to the database.

sql String insert into meter_****

The SQL statement.

timestamp Long 1644476100435

The time when the SQL query was executed. The value of this parameter is a UNIX timestamp. Unit: ms.

RequestId String 7172BECE-588A-5961-8126-C216E16B****

The ID of the request.

Success Boolean true

Indicates whether the request is successful. Valid values:

  • true
  • false

Examples

Sample requests

http(s)://das.cn-shanghai.aliyuncs.com/?Action=GetErrorRequestSample
&InstanceId=rm-2ze8g2am97624****
&SqlId=2cd4432556c3dab9d825ba363637****
&Start=1642556990714
&End=1642566830000
&DbName=testdb01
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetErrorRequestSampleResponse>
    <Code>200</Code>
    <Message>Successful</Message>
    <Data>
        <sqlId>2cd4432556c3dab9d825ba363637****</sqlId>
        <database>dbgateway</database>
        <originHost>172.16.1****</originHost>
        <tables>meter_****</tables>
        <instanceId>rm-2ze8g2am97624****</instanceId>
        <errorCode>1062</errorCode>
        <user>dbgat****</user>
        <sql>insert into meter_****</sql>
        <timestamp>1644476100435</timestamp>
    </Data>
    <RequestId>7172BECE-588A-5961-8126-C216E16B****</RequestId>
    <Success>true</Success>
</GetErrorRequestSampleResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Code" : 200,
  "Message" : "Successful",
  "Data" : [ {
    "sqlId" : "2cd4432556c3dab9d825ba363637****",
    "database" : "dbgateway",
    "originHost" : "172.16.1****",
    "tables" : [ "meter_****" ],
    "instanceId" : "rm-2ze8g2am97624****",
    "errorCode" : "1062",
    "user" : "dbgat****",
    "sql" : "insert into meter_****",
    "timestamp" : 1644476100435
  } ],
  "RequestId" : "7172BECE-588A-5961-8126-C216E16B****",
  "Success" : true
}

Error codes

HTTP status code 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.