08 Mar 2021
11:47 AM
- last edited on
24 May 2021
06:58 AM
by
MaciejNeumann
Is there an API to find the "context" of a tag just by giving a tag......without any entities? Or if not, then is there any way by which entity related to a particular tag can be found?
Solved! Go to Solution.
@BHA5472 If this is an automatic tag, you can also go into the UI and look that tag up to see what rules are defined for it. Additionally, you can also search for tag values in Dynatrace. If this is a Manual tag that was created, the same applies by searching for all manually applied tags via settings>Tags>Manually Applied.
There also is the API:
Hey Chad, these API doesn't tell you that information. Nd there is no API which can give you a list of manually applied tags without giving any entity.
Hey Dallas,
Context of tag means if a tag is automatically detected by Dynatrace say AWS tag, then context for that tag is AWS. If it is being discovered as Kubernetes, it's context will be kuberetes. There are tags which don't have any particular context, their context value is "CONTEXTLESS".
So, is there any way by which context of a particular tag could be found using API?
All manual and tags applied via autotag rule will be CONTEXTLESS. All AWS tags will have a context value of AWS and other technologies will follow similar conventions like KUBERNETES as Dallas mentioned above.
I'm assuming you want to search for manual tags, which is possible with the /api/v2/tags endpoint:
curl -x GET https://abc123.live.dynatrace.com/v2/api/tags?entitySelector=type("HOST"),tag("manualtag:value")
Retrieves this (if you actually have a host manually tagged with <pre>manualtag:value</pre>):
{
"totalCount": 1,
"tags": [{
"context": "CONTEXTLESS",
"key": "manualtag",
"value": "value",
"stringRepresentation": "manualtag:value"
}]
}
If this is not what you're asking, please elaborate on the usecase a bit more and I'll try to assist.