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

  • Home
  • SEARCH
  • 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 9055855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:03:25+00:00 2026-06-16T14:03:25+00:00

TL;DR Summary: Can I configure MVC Web API routing for HTTP GET, PUT &

  • 0

TL;DR Summary: Can I configure MVC Web API routing for HTTP GET, PUT & DELETE?

I’ve been looking into replacing our old Data Access Layer (a DLL based on DataSets and TableAdapters) with a private API, with a view to creating a public API if it’s successful. I’ve done some work with MVC 4 to refresh our frontend, and loved working with it, so it seems sensible to explore the "Web API" project type before diving into WS- or WCF-based libraries.

An initial demo allows me to return XML/JSON nicely, for example:

//service.url/api/Users

… returns a list of users, while a specific user’s details can be accessed via:

//service.url/api/Users/99

So far, so RESTful. However, in order to truly map URIs to resources I want to do an HTTP PUT (new user) or HTTP DELETE (remove user) to the the URI listed above. In all of the examples I’ve seen for these projects, along with the Scaffolds provided in Visual Studio, this convention is followed:

//service.url/api/Users/Create

//service.url/api/Users/Delete/99

//service.url/api/Users/Update/99

… and so on. This feels like side-stepping the issue to me, which is a shame when what’s there has been put together so nicely!

Any thoughts on how best to approach this?

  • 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-16T14:03:27+00:00Added an answer on June 16, 2026 at 2:03 pm

    What you want is the default in MVC Web API. I’m not sure what you are looking at but here is a great example of routing the Get/Post/Put/Delete to actions.

    For example you may want:

    public class UsersController : ApiController
    {
      // GET http://service.url/api/Users/1
      [HttpGet]
      public User GetUser(int id);
    
      // POST http://service.url/api/Users/?name=richard...
      [HttpPost]
      public User AddUser(User model);      
    
      // PUT http://service.url/api/Users/?id=1&name=Richard...
      [HttpPut]
      public User UpdateUser(User model);
    
      // DELETE http://service.url/api/Users/1
      [HttpDelete]
      public User DeleteUser(int id);
    }
    

    I’ve explicitly set these, but the GetUser and DeleteUser don’t need the prefix because they start with the matching HTTP method.

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

Sidebar

Related Questions

Where can I get a summary of differences between ActionScript 3.0 strict and standard
Question Summary: how can I get the path to the currently active application under
Summary: Can i get registry creation, modification, and last write times like i can
Summary Can you explain the reasoning behind the syntax for encapsulated anonymous functions in
SUMMARY How can I make my GUI application run on windows startup on a
Summary A parent can have many children. How do you write a service such
How can I make a list with pictures and summary (the text under the
Is there a tool available that can produce an HTML summary list of perl
How can I write this code more cleanly/concisely? /// <summary> /// Creates a set
I have column named summary (tinytext, utf8_turkish_ci). I know it can store 255 byte

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.