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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:24:56+00:00 2026-06-11T09:24:56+00:00

Given the uri… http://localhost:5613/api/user/1/HasCompletedInitialScreen I have the following route configured… public static class WebApiConfig

  • 0

Given the uri…

http://localhost:5613/api/user/1/HasCompletedInitialScreen

I have the following route configured…

public static class WebApiConfig
{
    public static void Register(HttpConfiguration config)
    {
        config.Routes.MapHttpRoute(
            name: "ApiUserHasCompletedInitialScreen",
            routeTemplate: "api/user/{id}/{hascompletedinitialscreen}");

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

and the controller action…

[HttpGet]
[ActionName("HasCompletedInitialScreen")]
public HttpResponseMessage HasCompletedInitialScreen(int id)
{
    var response = Request.CreateResponse<bool>(HttpStatusCode.Created, true);
    response.Headers.Location = GetLocation(id);
    return response;
}

However, I get a 404. How do I fix my route configuration and/or controller action to make this work?

Many thanks!!

UPDATE

Based on the accepted answer, I modified my api route definition to the following. Hope this helps someone else…

        config.Routes.MapHttpRoute(
            name: "QueryApi",
            routeTemplate: "api/{controller}/{id}/{action}");
  • 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-11T09:24:58+00:00Added an answer on June 11, 2026 at 9:24 am

    I’m not sure what you are trying to do but, if you want to be able to call

    http://localhost:5613/api/user/1/HasCompletedInitialScreen
    

    Your route needs to be like this:

    config.Routes.MapHttpRoute(
                    name: "ApiUserHasCompletedInitialScreen",
                    routeTemplate: "api/user/{id}/{action}",
                    defaults: new { controller = "Something" }
                );
    

    Where SomethingController is your controller containing the HasCompletedInitialScreen action.

    On a side note, you don’t need to declare ActionName attribute if its name is the same as your action method name.

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

Sidebar

Related Questions

How to get thumbnails from sdcard with the given URI ?? I have tried
Given the Following Code how Would i Change/Set my Silverlight WCF Service URI in
Given URI strings like: http://www.somesite.com/abc http://www.somesite.com/alpha/beta/abc http://www.somesite.com/alpha/abc What's the most elegant way in Ruby
Given a pack:// URI, what's the best way to tell whether a compiled resource
confused - given a track uri, I can get one album but possibly more
I want to redirect my '/' uri to a given controller's action. I used
Given that the web application doesn't have su privileges, I'd like to execute a
Given a uri like /home/ I want to find the view function that this
I am getting contact details for a given phone number using the following code:
Given the following code, How would you refactor this so that the method search_word

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.