Add Query History

Records a new entry in the query history table under the current session's account.

Required Permissions

A logged-in user can record entries under their own account.

HTTP Request

POST /api/sonar/query-history
cURL Example
curl -H "Authorization: Bearer <API_KEY>" \
     -d query="table sys_cpu_logs | stats avg(usage) by host" \
     -X POST \
     https://HOSTNAME/api/sonar/query-history
Request Parameters
KeyRequiredTypeDescriptionNote
queryOStringQuery stringQuery to record

Success Response

{}

Error Responses

Required argument is missing

HTTP status code 400

{
  "error_code": "null-argument",
  "error_msg": "query should be not null"
}
Session user not found

HTTP status code 500

{
  "error_code": "user not found",
  "error_msg": "user not found: 6c0e81d4-3a8b-4c91-9eb3-4f5a82d0a1b2"
}