REST stands for Representational State Transfer. It is an Architectural pattern more inclined towards a web. Web of Services should work in the same way as Web Of Pages works - each resource is identified by a unique id in the form of an URI. Resource can be anything; a Website, HTML page, XML document, etc. Services can be built on top of REST architecture. It is a structured way of uniquely identifying resources and accessing them. Uses only standard verbs POST, GET, PUT and DELETE. REST is not a standard as such but just an architectural pattern.

Rest Principles

Rest usage examples
REST - Yahoo web services use REST, including Flickr, del.icio.us API uses it
SOAP and REST both - EBay and Amazon
Google Web Services - SOAP
High REST and Low REST
High REST - Uses all 4 verbs and uses well-constructed URIs.
LOW REST - Uses mostly Get and POST verbs only. More suited for Ajax services.
NOTE
PUT and DELETE verbs are not supported by all browsers. Also, PUT and DELETE can be handled using POST verb itself.

HTTP Verbs

HTTP defines nine methods (sometimes referred to as "verbs") indicating the desired action to be performed on the identified resource.
Verb Action
GET Fetch a resource
PUT Update resource
DELETE Delete a resource
POST Append to resource

Advantages of REST

Limitations of REST

WCF REST basics

http://www.servicestack.net/ framework does it for you can you can as well do it yourself by defining multiple endpoints.
Sample Source Code
I am assuming that you have added an ADO.Net Entity Model object in your project file which maps to an Area table having the following fields
ID - Primary Key, varchar
Name - varchar
Code - varchar
This entity is available under SampleEntities Object context.
My code looks as below:

  1. using System.Collections.Generic;
  2. using System.Linq;
  3. using System.ServiceModel;
  4. using System.ServiceModel.Activation;
  5. using System.ServiceModel.Web;
  6. namespace WcfRestService1 {
  7. // Start the service and browse to http://:/Service1/help to view the service's generated help page
  8. // NOTE: By default, a new instance of the service is created for each call; change the InstanceContextMode to Single if you want
  9. // a single instance of the service to process all calls.
  10. [ServiceContract]
  11. [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
  12. [ServiceBehavior(InstanceContextMode = InstanceContextMode.PerCall)]
  13. // NOTE: If the service is renamed, remember to update the global.asax.cs file
  14. public class AreaService {
  15. [WebGet(UriTemplate = "/GetAllAreas", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare)]
  16. public List < area > GetAllAreas() {
  17. SampleEntities1 ctx = new SampleEntities1();
  18. var allAreas = (from p in ctx.Areas select p).ToList < area > ();
  19. return allAreas;
  20. }
  21. [WebGet(UriTemplate = "/GetArea/{id}", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
  22. public Area GetAreaWithID(string id) {
  23. SampleEntities1 ctx = new SampleEntities1();
  24. var area = (from p in ctx.Areas where p.ID == id select p).Single();
  25. return area;
  26. }
  27. [WebInvoke(UriTemplate = "/AddArea/{id} {name} {code}", Method = "POST")]
  28. public void AddArea(string id, string name, string code) {
  29. SampleEntities1 ctx = new SampleEntities1();
  30. Area a1 = new Area {
  31. ID = id, Name = name, Code = code
  32. };
  33. ctx.Areas.AddObject(a1);
  34. ctx.SaveChanges();
  35. }
  36. [WebInvoke(UriTemplate = "/Delete/{id}", Method = "DELETE", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
  37. public void DeleteArea(string id) {
  38. SampleEntities1 ctx = new SampleEntities1();
  39. Area a1 = ctx.Areas.Where(p = & gt; p.ID == id).SingleOrDefault();
  40. ctx.Areas.DeleteObject(a1);
  41. ctx.SaveChanges();
  42. }
  43. }
  44. }
I am using the default web.config which uses standard endpoints. WebHttpBinding is used for REST services as it does not Soap message format for data transmission. You can customize the message transmission format and choose either POX, JSON, AtomPub to name a few.
I am using C# Rest WCF Template available for .Net 4.0. It uses Routing and WebHttpBinding internally. So, there won't be any manual changes to the default web.config provided by the template. However, an entry for ADO.Net Entity object will be added too once you configure the ADO.Net Entity.