RESTful Web 服务简介

本文是RESTful Web Services: A Tutorial的笔记:

REST stands for Representational State Transfer, which is an architectural style for networked hypermedia applications, it is primarily used to build Web services that are lightweight, maintainable, and scalable. A service based on REST is called a RESTful service. REST is not dependent on any protocol, but almost every RESTful service uses HTTP as its underlying protocol.

尽管REST本身不依赖任何协议,但是事实上RESTful服务基本都使用HTTP协议。

RESTful服务本身的特性:

Every system uses resources. These resources can be pictures, video files, Web pages, business information, or anything that can be represented in a computer-based system. The purpose of a service is to provide a window to its clients so that they can access these resources. Service architects and developers want this service to be easy to implement, maintainable, extensible, and scalable. A RESTful design promises that and more. In general, RESTful services should have following properties and features, which I’ll describe in detail:

Representations
Messages
URIs
Uniform interface
Stateless
Links between resources
Caching

具体来说:
Representations:使用JSONXML
MessagesURIsUniform interface:使用HTTP协议;
Stateless:很重要,不同的request之间不能有依赖。

发表评论

邮箱地址不会被公开。 必填项已用*标注

This site uses Akismet to reduce spam. Learn how your comment data is processed.