Skip to main content

Retrieve data for a metric

Important

The GraphQL Insights API is currently in Early Availability status for customers on the AWS-US cluster. For more information, see GraphQL API policy.

Once you have data in your dataset, you can retrieve it by using a metric. Insights executes the query defined by your metric, applying any filter that is included in the query.

The input for this API must include a timeFrame with start and end DateTime values. These arguments are used as values for the mandatory date_created_from and date_created_to arguments in a metric query. (See Create a metric.)

The response is a simple table of data in the form of a two-dimensional array in JSON format.

Query

query visualizationMetricData(
$metricId: ID!
$timeFrame: VisualizationMetricTimeFrameInput!
$metricParams: [VisualizationMetricParamInput]!
) {
visualizationMetricData(
metricId: $metricId
timeFrame: $timeFrame
metricParams: $metricParams
)
}

Variables

{
"metricId": "d4615d7a-c384-486f-beff-6fb013a342ec",
"timeFrame": {
"start": "2021-10-18T20:48:02.025Z",
"end": "2021-10-19T20:48:02.025Z",
}
"metricParams": [
"paramKey": "MY_FILTER_1",
"paramValue": ["SOMETHING"]
]
}

Response

{
"data": {
"visualizationMetricData": [
["SOMETHING", "999"]
]
}
}

Was this page helpful?