# \[RESOLVED\] Use the same route for 2 possible parameters

**URL:** <https://discourse.slimframework.com/t/resolved-use-the-same-route-for-2-possible-parameters/2279>\
**Category:** Questions\
**Created:** [March 3, 2018, 5:17pm UTC](https://discourse.slimframework.com/t/resolved-use-the-same-route-for-2-possible-parameters/2279 "2018-03-03T17:17:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![budji](https://avatars.discourse-cdn.com/v4/letter/b/3be4f8/32.png) [@budji](https://discourse.slimframework.com/u/budji)\
**Post date:** [March 3, 2018, 5:17pm UTC](https://discourse.slimframework.com/t/resolved-use-the-same-route-for-2-possible-parameters/2279/1 "2018-03-03T17:17:27Z")

</div>

I’ve been searching the docs for this but either I can’t find it or don’t understand how to implement it.

I have the following that retrieves a record using an ID:

```
$app->get('/api/user/{id}, function ($request, $response, $args) {
    $id = $args['id'];
    echo $id;
});

```

and also wanted to retrieve a record using a username, i.e.

```
$app->get('/api/user/{username}, function ($request, $response, $args) {
  $username = $args['username'];
  echo $username;
});

```

but adding those two, gives me an error unless I replace the user route with ‘/api/user/test/{username}’.  
I would like to use the ‘/api/user/’ path so what would be the correct code for this?

**EDIT:** NVM, Found out about $app-\>group() 🙂
