cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Retrieve data by monitor name?

Lisa_Singh01
Participant

Is there a way download data from the API that shows the monitor display name rather than the unique ID (SYNTHETIC_TEST-0000000000014ADD style ID)?


I'm using python requests:

import requests
import pandas as pd
import io

URL = "https://ABCDE.live.dynatrace.com/api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.totalDuration&from=now-2d&to=now-1d"
headers = {"Authorization": "Api-Token " + "3qub092adsfaf3", "accept": "application/json"}
urlData = requests.get(URL, headers=headers).content
rawData = pd.read_json(io.StringIO(urlData.decode('utf-8')))


2 REPLIES 2

rene_forstner
Newcomer

You could use the names transformator:


api/v2/metrics/query?metricSelector=builtin%3Asynthetic.browser.totalDuration:names&from=now-2d&to=now-1d

Will return:

"result": [
{
"metricId": "builtin:synthetic.browser.totalDuration:names",
"data": [
{
"dimensions": [
"yourname",
"SYNTHETIC_TEST-57FE2AA4BBAF72E3"
],
"timestamps": [
1599640800000,
1599641400000,
1599642000000,

Lisa_Singh01
Participant

Oh you just made my day. Thank you so much for such a quick answer!

I'd read the help page on selector transformations, but the one thing it didn't mention was how to embed them into a URL (I suppose I should/could have worked that out but I'm new to this API stuff).



Featured Posts