Get query history

Get list of upcoming, running and performed queries from given time range.

GET https://api.supermetrics.com/enterprise/v2/query/history
  • api_key string
    Conditional. API key when not using an authorization header. See authentication for more.
  • ds_ids string | string[]
    Required. Target data source IDs, case-insensitive. See data sources for more.
  • status_codes string | string[]
    Optional. Target query status codes, case-insensitive. See query status codes for more. Defaults to all.
  • since string
    Optional. Return queries requested after given ISO 8601 datetime, date, or relative time, inclusively. Defaults to 24 hours ago. Limit of 90 days is enforced.
  • until string
    Optional. Return queries requested before given ISO 8601 datetime, date, or relative time, inclusively. Defaults to current time.
  • offset int
    Optional. Pagination offset for the number of queries to return. Defaults to 0.
  • limit int
    Optional. Maximum number of queries to return. Defaults to 100, maximum of 1000 is enforced.
Request
GET https://api.supermetrics.com/enterprise/v2/query/history?json={
    "api_key": "<api key>",
    "ds_ids": "GA,  AW",
    "since": "10 minutes ago"
}
Response
PropertyTypeDescription
meta > request_idstring API request ID
meta > filter > sincestring Used start time as ISO 8601 datetime string
meta > filter > untilstring Used end time as ISO 8601 datetime string
meta > paginate > offsetint Used pagination offset
meta > paginate > limitint Used pagination limit
meta > paginate > totalint Total number of queries found within time range
data > * > @typestring Object type. Always query_history.
data > * > schedule_timestring ISO 8601 datetime string for when query was requested
data > * > schedule_idstring Query schedule ID. See get status for more.
data > * > status_codestring Current query status code. See query status codes for more.
data > * > app_idstring Supermetrics product used to perform the query. Always API.
data > * > ds_idstring Query data source ID. See data sources for more.
data > * > total_rowsint Number of result rows in query results. Available only for query status codes SUCCESS and FAILURE. Defaults to null.
data > * > run_secondsfloat Query execution time in seconds. This does not include time spent in queue. Available only for query status codes SUCCESS and FAILURE. Defaults to null.
HTTP 200 OK
{
    "meta": {
        "request_id": "0eCfxd0MW0eua2sOybVSELtH_CSkk2RS",
        "filter": {
            "since": "2021-03-24T13:27:37+00:00",
            "until": "2022-03-24T13:37:37+00:00"
        },
        "paginate": {
            "offset": 0,
            "limit": 2,
            "total": 15
        }
    },
    "data": [
        {
            "@type": "query_history",
            "schedule_time": "2022-03-24T13:32:58+00:00",
            "schedule_id": "2508cadd2072c980f49047642b48ba3xea23eb7049d7771ac03375d0a9ea8x2e",
            "status_code": "FAILURE",
            "app_id": "API",
            "ds_id": "AW",
            "total_rows": 0,
            "run_seconds": 6.651
        },
        {
            "@type": "query_history",
            "schedule_time": "2022-03-24T13:25:17+00:00",
            "schedule_id": "88232zbfda75fda7f55b02e8c09z12352761ed274958c394bd77ez0105c39747",
            "status_code": "SUCCESS",
            "app_id": "API",
            "ds_id": "GA",
            "total_rows": 5,
            "run_seconds": 3.356
        }
    ]
}

Restrictions

  • Query history consists only from query metadata. Result data is not available beyond normal result expiry times. Read how to get query results with scheduled_id.

Missing something?

If you find that we are missing information or behaviour you absolutely need, please let us know.

Last updated 2022-06-15 UTC.