title: MVC routing my GET request to the wrong action
body: <p>I've got a URL routing issue in my application. I've tried to tackle the issue, but haven't really made any headway.</p>
  
  <p>So, I'm making the following AJAX request client-side:</p>
  
  <pre><code>$.ajax({
      type: 'GET',
      url: programState.getBaseUrl() + 'Playlist/GetPlaylistsByUserId',
      dataType: 'json',
      data: {
          userId: user.get('id')
      },
      success: function (data) {
          console.log("JSON data:", data);
      },
      error: function(error) {
          console.error(error);
      }
  });
  </code></pre>
  
  <p>Here's the network:</p>
  
  <p><img src="https://i.stack.imgur.com/IKlWe.png" alt="enter image description here"></p>
  
  <p>Here's the server error:</p>
  
  <p><img src="https://i.stack.imgur.com/Xm4NU.png" alt="enter image description here"></p>
  
  <p>Here's the Controller's methods for GET and GetPlaylistsByUserId:</p>
  
  <pre><code>[HttpGet]
  public ActionResult Get(Guid id)
  {
      Playlist playlist = PlaylistDao.GetById(id);
  
      return new JsonDataContractActionResult(playlist);
  }
  
  [HttpGet, ActionName("GetPlaylistsByUserId")]
  public ActionResult GetPlaylistsByUserId(Guid userId)
  {
      IList&lt;Playlist&gt; playlists = PlaylistDao.GetByUserId(userId);
  
      return new JsonDataContractActionResult(playlists);
  }
  </code></pre>
  
  <p>and finally, here are my routes:</p>
  
  <pre><code>routes.MapRoute(
      "getPlaylistsByUserId",
      "{controller}/{userId}",
      new { controller = "Playlist", action = "GetPlaylistsByUserId" },
      new { httpMethod = new HttpMethodConstraint("GET") }
  );
  
  routes.MapRoute(
      "post-Playlist",
      "{controller}",
      new { controller = "Playlist", action = "create" },
      new { httpMethod = new HttpMethodConstraint("POST") }
      );
  
  routes.MapRoute(
      "get-Playlist",
      "{controller}/{action}/{id}",
      new { controller = "Playlist", action = "get" },
      new { httpMethod = new HttpMethodConstraint("GET") }
      );
  
  routes.MapRoute(
      "put-Playlist",
      "{controller}",
      new { controller = "Playlist", action = "update" },
      new { httpMethod = new HttpMethodConstraint("PUT") }
      );
  
  routes.MapRoute(
      "delete-Playlist",
      "{controller}/{id}",
      new { controller = "Playlist", action = "delete" },
      new { httpMethod = new HttpMethodConstraint("DELETE") }
      );
  
  routes.MapRoute(
      "Default",
      "{controller}/{action}/{id}",
      new {controller = "Home", action = "Index", id = UrlParameter.Optional}
      );
  </code></pre>
  
  <p>As best as I can tell -- I am getting my URL routed to my 'Get' action, but I am intended it to be routed to the 'GetPlaylistsByUserId' action. I believe this to be happening because the server error states that it is looking for a paramater 'id' for method 'Get.'</p>
  
  <p>I'm not sure why any of this would be happening, though, as I seem to quite clearly have my other action mapped...?</p>