Manage saved queries
Saved queries are query configurations saved in Query Manager.
List queries
GET
https://api.supermetrics.com/enterprise/v2/queries
Response
Property | Type | Description |
meta > request_id | string | API request ID |
data | query[] | 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
Property | Type | Description |
meta > request_id | string | API request ID |
data | query | 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
Permissions
ds_queries_read
Object reference
query
Property | Type | Description |
query_id | string | Supermetrics query ID |
slug | string | Unique query slug string, used in query's short URL |
name | string | Custom query name |
ds_info | ds | Authenticated data source |
group_info | query_group | Group the query is saved into |
query_params | object | Query parameters in key-value pairs, as expected by the get data endpoint |
ds
Property | Type | Description |
ds_id | string | Data source ID. See data sources for more. |
name | string | Data source name |
query_group
Property | Type | Description |
group_id | string | Supermetrics query group ID |
name | string | Query group name |
Errors
Status | Error | Description |
404 | QUERY_NOT_FOUND | Requested saved query was not found. |
Last updated 2022-09-20 UTC.