REST services in MVC 4



REST stands for Representational State Transfer. What it says is that any request in/over HTTP should be one of the following types:

    GET – Get a resource from a server
    POST – Post/Insert/Input some information on a server
    PUT – Update some information on a server
    DELETE – Delete some information on a server

In REST architecture there is always a client and a server where the communication is always initiated by the client.

An important concept of REST is the uniform interface. The uniform interface contains a set of methods that can be understood by both the client and the server. In the HTTP uniform interface the important methods are GET, POST, PUT, DELETE, HEAD and OPTIONS. It is important to choose the right method for the right operation. For ex. if the client is going to get the resource from the server then they should use GET method. Likewise the DELETE method should be used to delete the resource and other methods has to be used appropriately based upon the action performed on the server. I wrote an article about using HTTP methods in REST applications and you can read it here.