Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8560709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:20:19+00:00 2026-06-11T16:20:19+00:00

Im using the New MVC Web Api I have something like this: public class

  • 0

Im using the New MVC Web Api I have something like this:

    public class CustomersController : ApiController
    {
  public HttpResponseMessage Get()
        {
            //Return Somethings
        }
    }

I call it with /api/customers

now i want to be able to filter by nationality and id so i made this :

public class CustomersController : ApiController
{
    public HttpResponseMessage Get(int Id, String Nat)
    {
        //and i filter here Return Somethings
    }
}

if i try to use /api/customers/1/us it call the first method, i understand that these are query strings, so how do i define route so i can use /api/customers/1/us ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T16:20:21+00:00Added an answer on June 11, 2026 at 4:20 pm

    Something like this should do the trick

    routes.MapHttpRoute(
         name: "CustomersByIdAndNat",
         routeTemplate: "api/customers/{Id}/{Nat}/",
         defaults: new { controller = "Customers" }
    );
    

    And as a side note, /1/us is not the querystring. Querystring is what it comes after ? symbol on urls. For instance in your case, could be something like this

    api/customers/?id=1&nat=us
    

    Not saying you need to change the url format, just explaining the concept.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using a Telerik MVC Splitter like this: @(Html.Telerik().Splitter().Name(MainSplitter) _ .Orientation(SplitterOrientation.Horizontal) _ .HtmlAttributes( New
I am new to ASP.Net MVC and ASP.Net web api. I have worked on
Using VS2010, creating a new MVC 4 Web API project. Just wondering, can the
Trying to set up a new site using MVC RC4 web API in Visual
I'm implementing a web API using the REST for ASP.NET MVC framework (MVC 2).
Azure web role (MVC 3 project) wont' start with Twilio controller class I have
I am considering building some services using the new Web API that's introduced in
I am developing some sort of service using asp.net mvc 4 web api. On
I using a reCaptcha on my web page under asp.net mvc. This web site
I'm new to using MVC and I'm trying to make a model that uses

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.