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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:29:46+00:00 2026-06-09T19:29:46+00:00

Is there a Web API equivalent to the MVC ActionMethodSelectorAttribute ? My specific purpose

  • 0

Is there a Web API equivalent to the MVC ActionMethodSelectorAttribute?

My specific purpose is this: I have, for example, a ResourceController and when I POST to the controller, I’d like to be able to receive a single resource (Resource) or a list (IEnumerable<Resource>).

I was hoping creating two methods with different parameters would cause the deserialization process to do some evaluation but this doesn’t seem to be the case (and frankly, I don’t think it’s efficiently realistic with the combination of content negotiation and the fact that many data formats, like JSON, make it difficult to infer the data type). So I originally had:

public HttpResponseMessage Post(Resource resource) {...}

public HttpResponseMessage Post(IEnumerable<Resource> resources) {...}

…but this gets the “multiple actions” error. So I investigated how to annotate my methods and came across ActionMethodSelectorAttribute but also discovered this is only for MVC routing and not Web API.

So… without requiring a different path for POSTing multiple resources vs. one (which isn’t the end of the world), what would I do to differentiate?

My thoughts along the ActionMethodSelectorAttribute were to require a query parameter specifying multiple, which I suppose is no different than a different path. So, I think I just eliminated my current need to do this, but I would still like to know if there is an equivalent ActionMethodSelectorAttribute for Web API 🙂

  • 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-09T19:29:48+00:00Added an answer on June 9, 2026 at 7:29 pm

    I haven’t seen a replacement for that method (there is an IActionMethodSelector interface but it is internal to the DLL). One option (although it seems like it might be overdoing it) is to overload the IHttpActionSelector implementation that is used.

    But changing gears slightly, why not always expect an IEnumerable<Resource>? My first guess is that the collection method (that takes IEnumerable<Resource>) would simply loop and call the single value (just Resource) function?

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

Sidebar

Related Questions

The standard route for the MVC Web API is {controller}/{id}. However I'd like to
In ASP.net MVC4 there's this 'new' concept of a web API for exposing CRUD
I'm aware there is Web API allowing this trick using current build number. But
Is there a web service API that takes this type of a latex http-request:
Is there any support in the asp.net mvc 4 web api beta for the
I'm adding some Web API services to an existing MVC application. I have a
I have a controller action in web api that return string token as below.Howver,
Is there a web-service/API that will provide information on who the US State and
there was a web application, that you could configure so that over the api,
Is there a common method/api to list all web browsers (name, executable, default yes/no)

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.