Skip to content

Building a Simple REST Controller with Microsoft Visual Studio 2012 and WebAPI

Updated: at 06:34 PM

Three Part Series

(Part 1)

 

Building a Simple REST Controller with Microsoft Visual Studio 2012 and WebAPI
Using Sencha ExtJS 4.2 and Sencha Architect 2.2, Build a Simple REST client (to feed WebAPI server)
Add CRUD to REST client for calling Microsoft WebAPI server

 

REST can be a very loaded term that brings up lots of discussions of what it means.  Just to mention a few sites that define it take a look at this list:

What is abundantly clear is there is not one clear concise explanation.  That said, I’m going to try and explain how to implement a Microsoft WebAPI REST controller that is written with Microsoft Visual Studio 2012.

First, you need to create the WebAPI controller.  I created a separate directory called “api” in my VS project for this purpose.  The dialog comes up as follows: (I chose “API controller with empty read/write actions” and renamed it to be TagsRest Controller.  My default url will now be http://mywebsite.com/api/TagsRest.

 

image

By default, the following controller class is made for me.

 

image

 

Surprising, I’m going to end the post here because we are really done.  There are empty methods, which is OK because I did not mean to define an implementation with this post, just show how to create a WebAPI REST controller which I’ve done.

In the next post, I’ll show how to create a simple Sencha ExtJS application that consumes this REST service.