Convert query
Endpoint to migrate Supermetrics API version 1 queries into a version 2 queries.
POST
https://api.supermetrics.com/enterprise/v2/query/convert
Parameters
-
api_key
string
Conditional. API key when not using an authorization header. See authentication for more.
-
urls
string[]
List version 1 query URLs, to be converted into version 2 queries
Request
POST /enterprise/v2/query/convert
Authorization: Bearer <your api key>
Content-Type: application/json
{
"urls": [
"https://supermetrics.com/api/getData?dataSource=GA&dateRangeType=...",
"https://supermetrics.com/api/getData?dataSource=FAstart-date=..."
]
}
Response
Property | Type | Description |
data > * > url | string | URL from the request |
data > * > error | object | If conversion failed, error details |
data > * > error > code | string | Error for the error. See errors for more. |
data > * > error > message | string | Short localized error message or code if not available |
data > * > error > description | string | Detailed localized error description |
data > * > result | object | If conversion succeeded, version 2 query details |
data > * > result > uri | string | URL to the endpoint to call with GET or POST |
data > * > result > params | object | New query parameters in key-value pairs. See get data for more. |
HTTP 200 OK
{
"meta": {
"request_id": "6_sLMK_ELN4ezNm2LLDIdMp8AoPSUAhC"
},
"data": [
{
"url": "https://supermetrics.com/api/v1/getData?",
"error": {
"code": "URL_INCOMPLETE",
"message": "Incomplete query URL",
"description": "Provided URL looks to be missing parameters."
}
},
{
"url": "https://supermetrics.com/api/v1/getData?...targetAppFormat=powerbi",
"result": {
"uri": "https://api.supermetrics.com/enterprise/query/data/powerbi",
"params": {
"ds_id": "GA",
"ds_accounts": "567890",
"ds_user": "e_35681351584",
"fields": "Year,EventAction,visits",
"settings": {
"avoid_sampling": true,
"timezone": "America/New_York"
},
"filter": "CampaignName =~ Super AND CampaignName != Superman",
"order_rows": "Year asc,EventAction desc"
}
}
}
]
}
Best practices
Make sure the migrated queries produce the same results as before. This endpoint only helps you transform previous query parameters into new ones — it does not perform result data comparisons.
When sending the version 2 query parameters, choose the method that works best for you. See making requests for details.
Last updated 2023-08-16 UTC.