# Retrieving the actual URL of an route with API versions prefilled

**URL:** <https://forum.shopware.com/t/retrieving-the-actual-url-of-an-route-with-api-versions-prefilled/88717>\
**Category:** Shopware 6 (English)\
**Created:** [30. Juni 2021 um 13:53 UTC](https://forum.shopware.com/t/retrieving-the-actual-url-of-an-route-with-api-versions-prefilled/88717 "2021-06-30T13:53:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Developer](https://avatars.discourse-cdn.com/v4/letter/d/bcef8e/32.png) [@Developer](https://forum.shopware.com/u/Developer)\
**Post date:** [30. Juni 2021 um 13:53 UTC](https://forum.shopware.com/t/retrieving-the-actual-url-of-an-route-with-api-versions-prefilled/88717/1 "2021-06-30T13:53:17Z")

</div>

I have a controller with some routes that looks like this. As you can see I use annotations to configure the controller routes.

```
 * @Route("/sales-channel-api/v{version}/foo/bar", defaults={"auth_enabled"=true},
 * name="my.route.name.label", methods={"POST"})
 *
 * @param Request $request
 * @param SalesChannelContext $salesChannelContext

```

In another part of my code I need this URL. Instead of making it a .env. variable or something I ask the router to retrieve the URL by name. But is just returns that exact value of the route as shown in the annotation block including the {version} placeholder.

Is possible to programmatically retrieve this route by name and let it replace the version placeholder for me automatically based on the context or so?

Code for retrieving the route.

```auto
        $callbackUrlPath = $this->router->getRouteCollection()->get( 'my.route.name.label')->getPath();
       // Actual output: /sales-channel-api/v%7Bversion%7D/foo/bar
      // Wanted output: /sales-channel-api/v3/foo/bar prefill the version based on a Context object or something

```

I’m using shopware 6.3
