RESTful CRUD App Single Resource
- [GET] /api/students - Index() - Get all students
- [GET] /api/students/:id - Show() - Get a student resource
- [POST] /api/students - Create() - Create a student resource
- [PUT] /api/students/:id - Update() - Update a student resource
- [DELETE] /api/students/:id - Delete() - Delete a student resource
- By default, only the GET and POST HTTP verbs are available in ASP.NET MVC. To use the other HTTP Verbs such as PUT and DELETE (i.e. for creating REST API endpoints), you need to edit your Web.config file and add the following XML code below. For more information, see this link
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*."
verb="GET,HEAD,POST,DEBUG,PUT,DELETE,OPTIONS"
type="System.Web.Handlers.TransferRequestHandler"
preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
- Enable local IIS feature in your Windows machine. This link shows how to setup your local IIS on your Windows machine as well as on how to publish your ASP.NET MVC web application on your local IIS
- If you are using Entity framework and Microsoft SQL Server, you may encounter problems on database authentication when you're browsing / fetching your RESTful API routes such as this one:
See the solution in these two links on how to resolve this issue:
- When testing your REST API endpoints using Postman, make sure the SSL certificate verification is turned off in the settings. See image below.