title: RESTful API endpoint naming
body: <p>I'm working on a asp.net core 2.2 backend exposing a RESTful API.</p>
  
  <p>The current implementation works fine (additional code removed for clarity):</p>
  
  <pre><code>namespace Sppd.TeamTuner.Controllers
  {
      [Authorize]
      [ApiController]
      [Route("[controller]")]
      public class UsersController : ControllerBase
      {
          private readonly ITeamTunerUserService _userService;
          private readonly ITokenProvider _tokenProvider;
          private readonly IAuthorizationService _authorizationService;
          private readonly IMapper _mapper;
  
          public UsersController(ITeamTunerUserService userService, ITokenProvider tokenProvider, IAuthorizationService authorizationService, IMapper mapper)
          {
              _userService = userService;
              _tokenProvider = tokenProvider;
              _authorizationService = authorizationService;
              _mapper = mapper;
          }
  
          [HttpGet]
          public async Task&lt;IActionResult&gt; GetByUserId(Guid userId)
          {
              // TODO: secure this call
              var user = _userService.GetByIdAsync(userId);
              return Ok(_mapper.Map&lt;UserDto&gt;(await user));
          }
      }
  }
  </code></pre>
  
  <p>The single API method works fine with URL <a href="https://localhost:5001/Users?userId=4AF29C4A-282A-4FB8-8691-9D44398A97F2" rel="nofollow noreferrer">https://localhost:5001/Users?userId=4AF29C4A-282A-4FB8-8691-9D44398A97F2</a></p>
  
  <p>Now I would like to add a second method:</p>
  
  <pre><code>[HttpGet]
  public async Task&lt;IActionResult&gt; GetByTeamId(Guid teamId)
  {
      // TODO: secure this call
      var users = _userService.GetByTeamIdAsync(teamId);
      return Ok(_mapper.Map&lt;IEnumerable&lt;UserDto&gt;&gt;(await users));
  }
  </code></pre>
  
  <p>Which would result in URL <a href="https://localhost:5001/Users?teamId=4AF29C4A-282A-4FB8-8691-9D44398A97F2" rel="nofollow noreferrer">https://localhost:5001/Users?teamId=4AF29C4A-282A-4FB8-8691-9D44398A97F2</a> (note that parameter is teamId instead of userId compared to first call).</p>
  
  <p>When testing with SwaggerUI, the page doesn't load and following exception is being shown:</p>
  
  <pre><code>An unhandled exception has occurred while executing the request.
  System.NotSupportedException: HTTP method "GET" &amp; path "Users" overloaded by actions - Sppd.TeamTuner.Controllers.UsersController.GetByUserId (Sppd.TeamTuner),Sppd.TeamTuner.Controllers.UsersController.GetByTeamId (Sppd.TeamTuner). Actions require unique method/path combination for Swagger 2.0. Use ConflictingActionsResolver as a workaround
     at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItem(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
     at System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
     at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.CreatePathItems(IEnumerable`1 apiDescriptions, ISchemaRegistry schemaRegistry)
     at Swashbuckle.AspNetCore.SwaggerGen.SwaggerGenerator.GetSwagger(String documentName, String host, String basePath, String[] schemes)
     at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
     at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.MigrationsEndPointMiddleware.Invoke(HttpContext context)
     at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
     at Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore.DatabaseErrorPageMiddleware.Invoke(HttpContext httpContext)
     at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)
  </code></pre>
  
  <p>Questions:<br>
  - Is this a SwaggerUI issue? Meaning would the controller work otherwise?<br>
  - Should the Users or the Teams controller expose the method to get all team users? We query by team id and return users.<br>
  - If it remains in the Users controller, what's the 'best' way to have unique endpoints?</p>