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 9153759
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:19:30+00:00 2026-06-17T12:19:30+00:00

I am using Web API to expose a bunch of services. I am having

  • 0

I am using Web API to expose a bunch of services. I am having issue with some routes and need some help.

I have the default route defined:

config.Routes.MapHttpRoute(
            name: "DefaultApi",
            routeTemplate: "api/{controller}/{id}",
            defaults: new {id = RouteParameter.Optional}
            );

With this route I can hit normal routes such as: ‘/api/clients/’ and ‘/api/clients/4’. I would like a GET that hits the following routes ‘api/clients/4/profiles’ and ‘api/clients/4/validations’.

I have tried the following routes without success:

config.Routes.MapHttpRoute(
    name: "ClientProfilesApi",
    routeTemplate: "api/{controller}/{clientid}/profiles",
    defaults: new { action = RouteParameter.Optional },
    constraints: new { controller = "clients" }
    );

 config.Routes.MapHttpRoute(
   name: "ClientValidationsApi",
       routeTemplate: "api/{controller}/{clientid}/validations",
       defaults: new { action = RouteParameter.Optional },
   constraints: new { controller = "clients" }
   );

I also tried using the ‘ActionName’ attribute as follows:

[HttpGet]
[ActionName("profiles")]
public IEnumerableResponseDto<ProfileLayoutDto> GetProfiles(Int64 clientId, [FromUri] IEnumerableRequestDto request)
{ .... }


[HttpGet]
[ActionName("profiles")]
public IEnumerableResponseDto<ValidationLayoutDto> GetValidations(Int64 clientId, [FromUri] IEnumerableRequestDto request)
{ .... }

What am I missing? Is it not possible to have multiple GETs in a controller?

  • 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-17T12:19:32+00:00Added an answer on June 17, 2026 at 12:19 pm

    For routes ‘api/clients/4/profiles’ and ‘api/clients/4/validations’, name the actions ‘profiles’ and ‘validations’ then use the following routes BEFORE the default route:

    config.Routes.MapHttpRoute(
        name: "ClientProfilesApi",
        routeTemplate: "api/clients/{clientid}/profiles",
        defaults: new { controller = "clients", action = "profiles",  },
        constraints: new {clientid = @"\d+" }
        );
    
     config.Routes.MapHttpRoute(
        name: "ClientValidationsApi",
        routeTemplate: "api/clients/{clientid}/validations",
        defaults: new { controller = "clients", action = "validations",  },
        constraints: new {clientid = @"\d+" }       );
    

    This means route ‘api/clients/4/profiles’ goes to controller ‘clients’ and action ‘ profiles’ and that the parameter ‘clientid’ has to be an integer.

    The default routes should ALWAYS be last.

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

Sidebar

Related Questions

I have several resources that I'd like to expose using the WCF Web API.
I am using MVC4's WEB API to expose a controller. Initially I created created
I'm using JAX-WS web services (client and exposed services), is there any API to
I am learning and using Web API and need to implement following Authentication mechanism
I am building a Web API using MVC4 and some request return blocks of
Currently we are trying to expose our Axis2 web services via WSO2 API manager.
I'm working on a API and using ASP.NET Web API in order to expose
We have a popular web-app developed using CodeIgniter. Now we want to expose our
On my web app using Java EE 6. I want to expose some of
I need to build very concurrent web service which will expose REST based API

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.