Querying Historical SQL Statements
Function
Query historical SQL statements.
URI
GET /v2/{project_id}/lts/history-sql
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Project ID. For details about how to obtain a project ID, see Obtaining the Account ID, Project ID, Log Group ID, and Log Stream ID. Minimum length: 1 character. Maximum length: 64 characters. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
log_group_id |
Yes |
String |
Log group ID. |
log_stream_id |
Yes |
String |
Log stream ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
User token obtained from IAM. For details about how to obtain a user token, see Obtaining a User Token. Minimum length: 1 character. Maximum length: 10,000 characters. |
Content-Type |
No |
String |
Set this parameter to application/json;charset=UTF-8. Minimum length: 30 characters. Maximum length: 30 characters. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
results |
Array of QuertHistorySQLResultsBody objects |
Return the result. |
Parameter |
Type |
Description |
---|---|---|
last_use_time |
Long |
Last modification time. The value is a timestamp, in milliseconds. |
sql_statement |
String |
Historical SQL statements. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
message |
ErrorMessagebody object |
Error message body. |
Parameter |
Type |
Description |
---|---|---|
code |
String |
Error code. Minimum length: 8 characters. Maximum length: 36 characters. |
details |
String |
Error description. Minimum length: 2 characters. Maximum length: 512 characters. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
message |
ErrorMessagebody object |
Error message body. |
Parameter |
Type |
Description |
---|---|---|
code |
String |
Error code. Minimum length: 8 characters. Maximum length: 36 characters. |
details |
String |
Error description. Minimum length: 2 characters. Maximum length: 512 characters. |
Example Requests
/v2/2a473356cca5487f8373be891bffc1cf/lts/history-sql?log_group_id=d1f4240d-5ee2-4e0b-9e2c-e25c7978c001&log_stream_id=f3d853be-0576-4dff-aee9-c093e4924b63
Example Responses
Status code: 200
Query SQL statements succeeded.
{ "results" : [ { "last_use_time" : 1669689650936, "sql_statement" : "SELECT *" }, { "last_use_time" : 1666775421613, "sql_statement" : "select count(\"t\") as pv" }, { "last_use_time" : 1666661494805, "sql_statement" : "SELECT count(\"time\")" }, { "last_use_time" : 1666598233252, "sql_statement" : "SELECT count(\"t\") as pv" }, { "last_use_time" : 1666598226763, "sql_statement" : "SELECT count(\"t\") " }, { "last_use_time" : 1666598222298, "sql_statement" : "SELECT count(\"t\") as pv" }, { "last_use_time" : 1666598221585, "sql_statement" : "SELECT count(\"t\") as p" }, { "last_use_time" : 1666598220276, "sql_statement" : "SELECT count(\"t\") as " }, { "last_use_time" : 1666598212453, "sql_statement" : "SELECT count(\"t\")" } ] }
Status code: 400
Invalid request. Modify the request based on the description in error_msg before a retry.
{ "message" : { "code" : "LTS.0603", "details" : "group or stream not exist" } }
Status code: 500
The server has received the request but encountered an internal error.
{ "message" : { "code" : "LTS.0203", "details" : "Internal Server Error" } }
Status Codes
Status Code |
Description |
---|---|
200 |
Query SQL statements succeeded. |
400 |
Invalid request. Modify the request based on the description in error_msg before a retry. |
500 |
The server has received the request but encountered an internal error. |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot