I am looking for some good links with best practices and sample code on creating RESTful web services using .NET.
Also, any other input you might have regarding REST would be greatly appreciated.
I am looking for some good links with best practices and sample code on creating RESTful web services using .NET.
Also, any other input you might have regarding REST would be greatly appreciated.
Windows Communication Foundation supports REST model since .NET 3.5.
You can find documentation and code samples on MSDN:
Some resources to learn REST:
The best introduction I have read is the RESTful Web Services book, which goes beyond explaining the model and principles and actually shows you how to design a RESTful web service. Most useful is its checklist for how to write/specify an REST API:
ADO.Net Data Servcies makes it really easy to build and consume RESTful web services in the .Net world but nevertheless understanding the concepts is important. Compared to WCF (which added REST support later), ADO.Net Data Services was built primarily for REST.
Guidelines for Building RESTful Web Services has all the info on the resources you need.
This is another useful blog entry:
The uniform interface constraints describe how a service built for the Web can be a good participant in the Web architecture. These constraints are described briefly as follows :
1) Identification of resources: A resource is any information item that can be named and represented (e.g. a document, a stock price at a given point in time, the current weather in Las Vegas, etc). Resources in your service should be identified using URIs.
2) Manipulation of resources via representations: A representation is the physical representation of a resource and should correspond to a valid media type. Using standard media types as the data formats behind your service increases the reach of your service by making it accessible to a wide range of potential clients. Interaction with the resource should be based on retrieval and manipulation of the representation of the resource identified by its URI.
3)Self-descriptive messages: Following the principles of statelessness in your service's interactions, using standard media types and correctly indicating the cacheability of messages via HTTP method usage and control headers ensures that messages are self descriptive. Self descriptive messages make it possible for messages to be processed by intermediaries between the client and server without impacting either.
4)Hypermedia as the engine of application state: Application state should be expressed using URIs and hyperlinks to transition between states. This is probably the most controversial and least understood of the architectural constraints set forth in Roy Fielding's dissertation. In fact, Fielding's dissertation contains an explicit arguments against using HTTP cookies for representing application state to hammer this point home yet it is often ignored.
The articles from the "RESTful Web" series at xml.com are a great introduction.
The author (Joe Gregorio, of The Atom Publishing Protocol fame) also regularly publishes insightful articles about all things REST on his weblog. "RESTify DayTrader" (REST Architecture applied to a benchmark stock trading application) is a good starting point. I also like "Why so many Python web frameworks?", which shows the implementation of a small restful web framework in Python.
Saw Dan Rigsby give a presentation on RESTing on the Web with WCF.
He has some solid examples, and his presentation explained the whole REST concept very clearly.