Rest

REST, or REpresentational State Transfer, is an application model first defined by Roy Fielding in his doctoral thesis. While you may have never heard of Roy Fielding in the past, you likely use one of his creations daily; he was one of the principal authors of the HTTP specification. In his thesis, he described a way to create applications that "work the way the Internet works":

V Every piece of data (or resource) is uniquely identified by some address within the system.

V You use a consistent interface for accessing these resources.

V You process these resources through representations of the resources, in known data formats.

V The entire system is stateless.

Applying these principals to the Internet, you can see how they work in action:

V Every Web page is defined using a unique URL (Uniform Resource Locator).

V The HTTP protocol defines a number of verbs that may be used to act on those URLs. While the two most commonly used verbs are GET and POST, many others are available (e.g., PUT and DELETE).

V When you request a specific resource, you receive the content along with the MIME type of that content.

V HTTP is very stateless (as many new ASP.NET developers painfully discover).

WCF Data Services provides this mechanism for working with your data. It adds an additional layer to your applications that enables you to manipulate an Entity Framework model (or other data, as you'll see below) using this RESTful model:

V Each query, record, or field within your database can be uniquely identified using a URL, such as http://example.com/PubsService.svc/authors('172-32-117 6')

V You use the same HTTP verbs to access your data (GET to retrieve an item, POST to insert new records, PUT to update them, and DELETE to delete them).

V When requesting data, you receive it in Atom or JSON format.

V The entire system remains stateless, typically with optimistic concurrency when changing records.

0 0

Post a comment