# In DQL DPL, what is the best way to separate an endpoint and its target?

**URL:** <https://community.dynatrace.com/t/in-dql-dpl-what-is-the-best-way-to-separate-an-endpoint-and-its-target/51078>\
**Category:** DQL\
**Tags:** dql, notebooks, dpl\
**Created:** [April 4, 2025, 10:42pm UTC](https://community.dynatrace.com/t/in-dql-dpl-what-is-the-best-way-to-separate-an-endpoint-and-its-target/51078 "2025-04-04T22:42:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![chloe\_bennett](https://avatars.discourse-cdn.com/v4/letter/c/8dc957/32.png) [@chloe\_bennett](https://community.dynatrace.com/u/chloe_bennett)\
**Post date:** [April 4, 2025, 10:42pm UTC](https://community.dynatrace.com/t/in-dql-dpl-what-is-the-best-way-to-separate-an-endpoint-and-its-target/51078/1 "2025-04-04T22:42:23Z")

</div>

Hello! Using DQL, I’d like to use the “parse” command to break a string like “/api/abc/abc/abc/123” into “endpoint=/api/abc/abc/abc/”, and “target=123”. Ideally, I can apply this to any incoming API call.&nbsp;The strings may represent different API calls, so the output I’m looking for is something like the following:

- **“/api/abc/abc/abc/123”** =\>&nbsp; **“endpoint=/api/abc/abc/abc/{\*}”** and **“target=123”**
- **“/api/abc/123”** =\>&nbsp; **“endpoint=/api/abc/{\*}”** and **“target=123”**
- **“/api/abc/abc/123/def”** =\>&nbsp; **“endpoint=/api/abc/abc/{\*}/def”** and **“target=123”**

I’m trying to make the **“{\*}”** a literal replacement for the data that I take out.

The end goal is to eventually aggregate the occurrences of a specific endpoint even without the target, or interactions with a target even without the endpoint.

Would you have any idea how to do this? I’d really appreciate the help! Thanks in advance!

---

<div class="post-metadata">

**Author:** ![yanezza](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/yanezza/32/5036_2.png) [@yanezza](https://community.dynatrace.com/u/yanezza)\
**Post date:** [April 5, 2025, 4:47pm UTC](https://community.dynatrace.com/t/in-dql-dpl-what-is-the-best-way-to-separate-an-endpoint-and-its-target/51078/2 "2025-04-05T16:47:36Z")

</div>

Hello!

Using DQL, it is feasible to achieve this. I will execute two pipe:

1. the first to extract the target  
_NOTE: this is where you need to handle the complexity, but with [DPL](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-pattern-language/log-processing-grammar) you can manage it well)_
2. and then I will generate the endpoint fields using a&nbsp;[replaceString](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/functions/string-functions#replaceString)&nbsp;function with the target string.  
_NOTE: If you need more complexity, you could also use a&nbsp;[replacePattern](https://docs.dynatrace.com/docs/discover-dynatrace/references/dynatrace-query-language/functions/string-functions#replacePattern)&nbsp;function._

```markup
data record(span = "/api/abc/abc/abc/123")
| fieldsAdd parse(span," '/api/abc/abc/abc/' LD:target")
| fieldsAdd endpoint = replaceString(span, target, "{*}" )
| fields target, endpoint

```
