# Extracting context root from a URL to tag it

**URL:** <https://community.dynatrace.com/t/extracting-context-root-from-a-url-to-tag-it/34247>\
**Category:** Open Q&A\
**Tags:** tagging, request-attributes, dynatrace-api\
**Created:** [February 23, 2022, 1:01pm UTC](https://community.dynatrace.com/t/extracting-context-root-from-a-url-to-tag-it/34247 "2022-02-23T13:01:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erh\_inetum](https://avatars.discourse-cdn.com/v4/letter/e/48db29/32.png) [@erh\_inetum](https://community.dynatrace.com/u/erh_inetum)\
**Post date:** [February 23, 2022, 1:01pm UTC](https://community.dynatrace.com/t/extracting-context-root-from-a-url-to-tag-it/34247/1 "2022-02-23T13:01:37Z")

</div>

Hi,

We have an URL like /application-context-root/text1/text2/text3/text4 which is served by a service.

We would like to extract the chain /application-context-root/ in order to create an automatic tag rule using this chain.

We’ve created a request attribute which extract the info but automatic tag rules don´t allow using a request attribute to tag something.

We have also launched Detection full web request API called

curl -X GET “[https://mytenant/api/config/v1/service/detectionRules/FULL\_WEB\_REQUEST](https://mytenant/api/config/v1/service/detectionRules/FULL_WEB_REQUEST)” -H “accept: application/json; charset=utf-8” -H “Authorization: Api-Token mytoken”

but we receive the following error: TypeError: NetworkError when attempting to fetch resource.

Is there any way to get the context root in order to create an automatic rule to tag it?

Thanks in advance.

Regards,

Elena.

---

<div class="post-metadata">

**Author:** ![axel\_ayala](https://avatars.discourse-cdn.com/v4/letter/a/9fc348/32.png) [@axel\_ayala](https://community.dynatrace.com/u/axel_ayala)\
**Post date:** [March 7, 2022, 4:41pm UTC](https://community.dynatrace.com/t/extracting-context-root-from-a-url-to-tag-it/34247/2 "2022-03-07T16:41:12Z")

</div>

If I understand correctly, you can try something like this, as the context root is metadata we detect OOTB:

 ![axel_ayala_0-1646671253647.png](https://global.discourse-cdn.com/dynatrace/original/3X/9/f/9f416a34ef28675e7e6d5b047d73a8859e9beb45.png)
