REST入门 [英] Getting started with REST

查看:91
本文介绍了REST入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一些最佳实践的良好链接,以及创建 REST ful网络的示例代码使用.NET的服务。

I am looking for some good links with best practices and sample code on creating RESTful web services using .NET.

此外,您可能会对REST提出的其他任何建议也将不胜感激。

Also, any other input you might have regarding REST would be greatly appreciated.

推荐答案

ADO.Net数据服务可以使在.Net世界中构建和使用 RESTful Web服务真的很容易但是理解这些概念很重要。与WCF(后来增加了REST支持)相比,ADO.Net数据服务主要是为REST构建的。

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.

构建RESTful Web服务的指南包含您所需资源的所有信息。

Guidelines for Building RESTful Web Services has all the info on the resources you need.

这是另一个有用的博客条目

统一的接口约束描述了为Web构建的服务如何成为Web体系结构的良好参与者。这些限制条件简要描述如下:

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)资源标识:资源是可以命名和表示的任何信息项(例如,文档,股票价格为给定的时间点,拉斯维加斯的当前天气等)。服务中的资源应使用URI标识。

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)通过表示操纵资源:表示是资源的物理表示,应与有效的媒体类型相对应。通过将标准媒体类型用作服务背后的数据格式,可以使广泛的潜在客户访问该服务,从而扩大服务范围。与资源的交互应基于对由其URI标识的资源表示的检索和操作。

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)自描述消息:遵循服务交互中的无状态原则,使用标准媒体类型,并通过HTTP方法用法和控制标头正确指示消息的可缓存性确保消息具有自我描述性。自描述消息使客户端和服务器之间的中介可以处理消息,而不会影响两者。

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)超媒体作为应用程序状态的引擎:应使用URI和超链接来表示应用程序状态,以在状态之间进行转换。对于中提出的体系结构约束,这可能是最具争议和了解最少的罗伊·菲尔丁的论文。实际上,Fielding的论文包含一个明确的论点,反对使用HTTP cookie来表示应用程序状态,以此来说明这一点,但它经常被忽略。

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.

这篇关于REST入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆