tags:

views:

2252

answers:

4

I am thinking to start writing some REST web services as a way to provide data. I guess that when my REST web services are available, then some of my web applications and console applications will be able to use REST web service as data service to get, add, update and delete data to databases. In addition to that, I would like to add authentication feature to identify any request.

My question is that where should I start? I saw Microsoft ADO.Net Data Services. Not sure if this is a good start place? Are there any examples available?

+4  A: 

Check out the REST in WCF MSDN site and the starter kit. Good article here too.

JP Alioto
That first link doesn't talk specifically about C# or .Net at all, it only speaks about REST in general.
Earlz
A: 
  • If you're going WCF, the WCF REST Starter Kit that JP referred to is a great place to start.
  • Omar Al Zabir provides a pretty good example of using ASP.NET MVC to provide RESTful services that are fluent in both XML and JSON
  • You can also go the ADO.NET Data Services route you suggested. These services are built on top of the WCF stack.

I've never stumbled across any really good guidance on how to select between these options. In ASP.NET MVC you take on the majority of the plumbing burden but also have maximal control. Straight RESTful WCF is the happy middle ground although WCF tends to want to have things done its way. ADO.NET Data Services are pretty magical with the downside of buying fully into a given approach to generating these services and losing more flexibility.

There are a couple of good books you can read on the topic of RESTful services with .NET. Both O'Reilly and Microsoft Press have recently released books on this topic. Perhaps the most important advice I can provide you is to consume and understand several open RESTful services (e.g. Twitter, Amazon, Flickr) to understand the design decisions that went into creating the services. User provisioning, authentication mechanism, and supported content types (e.g. JSON, XML, RSS/ATOM) are some of the decisions that you can observe in action to aid you in your path to creating your service API.

Thomas Beck
+1  A: 

If you are new to REST in the .net world then start with OpenRasta. The other Microsoft solutions can do REST if you work hard at it but they will guide you down a route where you will most likely end up with POD(Plain old data) over HTTP. That is not what REST is all about. If that's all you want then that's cool too, but it is not REST.

Darrel Miller
I didn't know OpenRasta has so many cool features. And I was almost sure it is some kind of framework for building ASP.NET MVC websites. Thanks!
MaciekTalaska
A: 

May I ask, out of interest, why you need ReST to simply expose your database? What scenario are you trying to solve?

serialseb
one example is that we have a database that is charged by license based on connection calls from machines. Within one machine, there is no limit to make calls but we have to pay for calls from other PCs. In addition to that, network fire-wall is another issue. So I think REST web service may be the best way to resolve the issue. We can make calls to the REST service and let the REST service to make one connection or local calls to db.
David.Chu.ca