Manage saved queries

Saved queries are query configurations saved in Query Manager.

List queries

GET https://api.supermetrics.com/enterprise/v2/queries
Response
PropertyTypeDescription
meta > request_idstring API request ID
dataquery[] Partial saved query objects. See example for included properties.
HTTP 200 OK
{
    "meta": {
        "request_id": "WnjTGeKqOXTnkZQMbZCfVMdmswv2wAzx"
    },
    "data": [
        {
            "@type": "query",
            "query_id": "qr_1",
            "slug": "58463...c03",
            "name": "My Query",
            "ds_info": {
                "@type": "ds",
                "ds_id": "GA",
                "name": "Google Analytics"
            },
            "group_info": {
                "@type": "query_group",
                "group_id": "qrg_1",
                "name": "My Google Analytics Queries"
            }
        }
    ]
}
Permissions

ds_queries_read


Get query

GET https://api.supermetrics.com/enterprise/v2/query/:query_id
  • query_id string
    Supermetrics query ID
Response
PropertyTypeDescription
meta > request_idstring API request ID
dataquery Saved query object
HTTP 200 OK
{
    "meta": {
        "request_id": "iAf8Zumwbw5tZIyW2RgA66hyK3tpaReD"
    },
    "data": {
        "@type": "query",
        "query_id": "qr_1",
        "slug": "58463...c03",
        "name": "My Query",
        "ds_info": {
            "@type": "ds",
            "ds_id": "GA",
            "name": "Google Analytics"
        },
        "group_info": {
            "@type": "query_group",
            "group_id": "qrg_1",
            "name": "My Google Analytics Queries"
        },
        "query_params": {
            "ds_id": "GA",
            "ds_accounts": "567890",
            "ds_user": "info@supermetrics.com",
            "date_range_type": "this_month_inc",
            "fields": "Date,Sessions",
            "schedule_id": "58463...c03"
        }
    }
}
Errors

QUERY_NOT_FOUND

Permissions

ds_queries_read


Object reference

query
PropertyTypeDescription
query_idstring Supermetrics query ID
slugstring Unique query slug string, used in query's short URL
namestring Custom query name
ds_infods Authenticated data source
group_infoquery_group Group the query is saved into
query_paramsobject Query parameters in key-value pairs, as expected by the get data endpoint

ds
PropertyTypeDescription
ds_idstring Data source ID. See data sources for more.
namestring Data source name

query_group
PropertyTypeDescription
group_idstring Supermetrics query group ID
namestring Query group name

Errors

StatusErrorDescription
404QUERY_NOT_FOUNDRequested saved query was not found.
Last updated 2022-09-20 UTC.