RESTful Web Services Part 2 - Characteristics
来源:互联网 发布:大数据赚钱吗 编辑:程序博客网 时间:2024/05/23 19:19
1. Resources
A resource is a thing that:
- is unique (i.e., can be identified uniquely)
- has at least one representation
- has one or more attributes beyond ID
- has a potential schema, or definition
- can provide context, and
- is reachable within the addressable universe
A resource can be practically anything:
- A blog post
- A collection of blog posts
- An image
- A user
- Map coordinates
- A bank transaction
- Search results
- Documents
- People
- Places
- Abstract Concepts (e.g. processes,transactions)
A resource can be explored to:
- Web Side
- Resume
- Aircraft
- A Song
- An Employee
- A Transaction
Not Resource* - Even these could be resources in the right context, but you have to stretch some to find it:
- Mailing Address
- $32.76
- A Gallon of Gasoline
- Love
2. Representations
A representation is a description of a resource that is used for some computational purpose. Representations can be thought of as models of the resource is question, and as is the case with any modeling, a given resource may have any number of distinct representations.
- A Kitten
- Some Text
- Name:Bob
- Breed:Tabby
- ……
- A Picture/A Drawing/A Haiku/A BlogPost
- HTML
- <!DOCTYPE html>
- <html lang=“en”></html>
- Video
3. Representational State Transfer
- A representation shows a reflection of the state of a given resource in a given form
- This “representational state”collapses to the resource description itself when the resource is static, but will change if the resource itself changes
- The transfer of this representational state between nodes in the network is the fundamental operation of the web
4. Addressability
Every resource has at least one URI; every URI points to a resource.
- http://example.com/entities/2012/02/restful-web-services
- http://example.com/tags/awesome
- http://example.com
5. Idempotency
Being able to perform an operation multiple times without changing theresult after the initial operation
6. Connectedness
- Resources Link to Each Other
- Connectedness
- <?xml version=“1.0” encoding=“UTF-8” ?>
- <resource xmlns=http://example.com/ns/resource >
- <content>…</content>
- <nextResource href=http://example.com/resource/3/>
- <prevResource href=http://example.com/resource/1/>
- </resource>
- <link rel=“alternate”type=“application/atom+xml” href=http://example.com/resource/2.atom/>
- HATEOAS - Hypermedia as the Engine of Application State
7. Statelessness
- HTTP Is Stateless - Every Request Happens in Isolation
- State Machine
- Resource State – Server-Side
- Application State – Client-Side
- Transferring Sate – Every HTTPrequest transfers state between the application and the requested resource
- Resource-> Application e.g. GET
- Resource<- Application e.g. PUT
- Representation State Transfer
0 0
- RESTful Web Services Part 2 - Characteristics
- RESTful Web Services Part 1 - Definition
- RESTful Web Services Part 3 - URI
- RESTful Web Services Part 4 - Interaction Design
- RESTful Web Services Part 5 - Relevant Concepts
- RESTful Web Services Part 6 - Maturity Model
- RESTful Web Services [ILLUSTRATED]
- RESTful Web Services
- RESTful Web Services
- RESTful Web Services初探
- RESTful Web Services初探
- RESTful Web Services - Methods
- RESTful Web Services
- Restful Web Services
- RESTful Web Services初探
- In-Sights into Web Services - Part 2
- RESTFul Web Services for DotNet
- Manual:RESTful Web Services (Chinese)
- this的用法
- 对称加密与非对称加密
- 本地计算机连接远程mysql
- 程序员之路
- ApacheBench(AB) 网页压力测试
- RESTful Web Services Part 2 - Characteristics
- 博客已搬家
- Python3.4.1爬虫编写笔记
- iOS7 新UI 一
- 通过金矿模型介绍动态规划
- 数据结构之字符串
- HDU 4080 UVaLive 4513 - Stammering Aliens (字符串hash)
- UIWebView项目中在多个webview加入自定义全局UserAgent
- [leetcode]107.Binary Tree Level Order Traversal II