Get query history

Gets the query execution history for the currently logged-in user from the last 30 days.

Required Permissions

A logged-in user can only retrieve their own query history.

HTTP Request

GET /api/sonar/query-history
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     https://HOSTNAME/api/sonar/query-history
Request Parameters
KeyRequiredTypeDescriptionNote
offsetNo32-bit integerNumber of records to skipDefault: 0
limitNo32-bit integerMaximum number of records

Success Response

{
  "total_count": 2,
  "queries": [
    {
      "query": "table sys_cpu_logs",
      "created_at": "2024-01-15 10:30:25+0900"
    },
    {
      "query": "system tables",
      "created_at": "2024-01-15 09:15:00+0900"
    }
  ]
}
  • total_count (32-bit integer): Total number of query history records
  • queries (Array): Query history list
    • query (String): Executed query string
    • created_at (String): Query execution date and time

Error Responses

offset or limit value is not an integer

HTTP status code 400

{
  "error_code": "invalid-argument",
  "error_msg": "'offset' parameter should be int type"
}