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

How can I convert synthetic test ID into the actual test name?

Lisa_Singh01
Participant

When pulling down data the results I get indicate the test ID but I don't know how to convert these into th etest name in human readable form.

 

That is, if I get a result like

builtin:synthetic.browser.totalDuration,SYNTHETIC_TEST-0000000000014AZ0,2020-02-03 08:30:00,3150.5

I'd prefer to get the result with the actual name rather than SYNTHETIC_TEST-0000000000014AZ0. Of even download a reference of test names and their IDs.

 

I hope that makes sense, not 100% sure on the correct terminology.

10 REPLIES 10

MateuszKulewicz
Inactive

Hi @Lisa S.!

You can get the monitor name using our Dynatrace APIs by either fetching a list of all monitors on your environment - https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/synthetic/synt... - that contains both the synthetic test IDs and their names, or you could get more information about a single monitor by using GET monitor call - https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/synthetic/synt... .

Thank you! I'll give that a go and update / close this.

I tried that and all that was returned was: {"monitors":[]}

What is the outcome of GET /monitor - https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/environment-api/synthetic/synt... if you provide SYNTHETIC_TEST-0000000000014AZ0 as the monitor ID that you mentioned in the ticket? The response from GET /monitors would suggest that either the token you were using to authenticate doesn't allow you to access the monitors or that the filters that you added in the call were too restrictive.

I tried using the api explorer to build the curl syntax and ended up with:

curl -get -x www-cache.ourdomain.com:80  "https://SaaSID.live.dynatrace.com/api/v1/synthetic/monitors?api-token=ABCDEFG12345--ays&tag=chrome"

Which returns:

{"monitors":[]}

I just used that monitor as an example. Basically I want just build a list that matches all the monitor IDs with their names (would canonical be the right word here?). That I would use to substitute the ID with the name in Excel when I send out the report.

The other option if I can figure it out is when pulling down a load of metrics, for the name rather than the ID to be returned from the query in the first place.

Sorry if these are silly questions, I'm basically an absolute beginner here.



This call returned a response and not an authentication error, so it seems that you are authenticated correctly. If you remove `&tag=chrome`, are there any monitors on the list?

Aha - that's done it! It'd be more useful to be able to just pull out the 18 names/IDs I need for this report (tagged chrome). The API explorer did have a tag input, but from what I can see v1 explorer doesn't construct URLs with the auth token, so I improvised. Surely there must be a way to have both the token and the tag in the URL?


Hmmm...

It should work, however it might be useful to check if tag shouldn't be upper case - it depends on how the tag itself was created. The endpoints are case sensitive so it might be good to experiment a bit.


The API explorer uses header-based auth which is possible to set up in curl as well using `--header` parameter as shown here - https://www.dynatrace.com/support/help/extend-dynatrace/dynatrace-api/basics/dynatrace-api-authentic...

Oh duh. You are absolutely right, the tag was uppercase. Thank you so much for your help.

Great to hear it works! Glad I could help.

Featured Posts