API Endpoints and Structure
<p>I am creating a Web Api with ASP.NET Core and I have the following:</p>

<pre><code>public class MessageApiController : Controller {

  [HttpGet("messages/{id}")]
  public async Task&lt;IActionResult&gt; GetById() { }

}

public class UserApiController : Controller {

  [HttpGet("users/{id}")]
  public async Task&lt;IActionResult&gt; GetById() { }

}
</code></pre>

<p>Now I need to get all messages for a user. I know two options:</p>

<pre><code>  [HttpGet("messages")]
  public async Task&lt;IActionResult&gt; GetMessagesByUser(Int32 userId) { }
</code></pre>

<p>Or </p>

<pre><code>  [HttpGet("users/{userId}/messages")]
  public async Task&lt;IActionResult&gt; GetMessagesByUser(Int32 userId) { }
</code></pre>

<p>I have a few questions:</p>

<ol>
<li>Which is more common? I think I could even use both ...</li>
<li>When using "users/{userId}/messages" would you place this action in MessageApiController or UserApiController? </li>
</ol>