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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:46:01+00:00 2026-06-13T12:46:01+00:00

[HttpGet] [ActionName(all)] public HttpResponseMessage GetAllCompetitions() { return Request.CreateResponse(HttpStatusCode.OK, Repository.FindAll()); } [HttpGet] [ActionName(GetCompetition)] public HttpResponseMessage

  • 0
[HttpGet]
    [ActionName("all")]
    public HttpResponseMessage GetAllCompetitions()
    {
        return Request.CreateResponse(HttpStatusCode.OK, Repository.FindAll());
    }

    [HttpGet]
    [ActionName("GetCompetition")]
    public HttpResponseMessage GetCompetitionById(long id)
    {
        Competition competition = Repository.FindById(id);
        if (competition == null)
        {
            return Request.CreateResponse(HttpStatusCode.NotFound);
        }
        return Request.CreateResponse(HttpStatusCode.OK, competition);
    }

    [HttpGet]
    [ActionName("format")]
    public HttpResponseMessage format(string postedFormat)
    {
        CompetitionMediaFormat format = (CompetitionMediaFormat)Enum.Parse(typeof(CompetitionMediaFormat), postedFormat, true);

        return Request.CreateResponse(HttpStatusCode.OK, Repository.FindByFormat(format));
    }

I am able to hit the first two get methods but when i hit “format” method am getting a 404 Not found error

Client App call

var response = await client.GetAsync(“api/Competition/format/music”);

Route Config

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

Please let me know where am going wrong?

  • 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-13T12:46:01+00:00Added an answer on June 13, 2026 at 12:46 pm

    It is because of the name of the parameter ‘postedFormat’, it will not match with your route paramter name ‘id’. Try adding a route that specifies postedFormat as the last parameter.

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

Sidebar

Related Questions

I have this code in my controller: [HttpGet] public ActionResult Register(UserRegistrationModel model) { return
public InputStream getInputStream() { AndroidHttpClient client = AndroidHttpClient.newInstance(USERAGENT); HttpUriRequest request = new HttpGet(url); InputStream
What is wrong? Model is always null. Controller [HttpGet] public ViewResult Add() { return
<HttpGet()> Public Function Search(<FromUri()> ByVal name As Name) As HttpResponseMessage // get params from
Get User Action [HttpGet] [ActionName(Index)] public ActionResult Get(int id) { User u = UserCore.GetUser(id);
I have the edit action method pair: [HttpGet] public ActionResult Edit(Guid id) { return
I have 2 action methods: [HttpGet] public ActionResult Customize() { return View(new CustomizeViewModel {
I'm having trouble when handling the Post request for my controller: [HttpGet] public ActionResult
HttpGet request = new HttpGet(https://192.168.1.140:8732/...); I wonder why I can only send successfully for
I have the following controller action: [HttpGet] public JsonpResult getTestValues(int? entityId, int? id) {

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.