RESTful Web Services Part 2 - Characteristics

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.

5. Idempotency

    Being able to perform an operation multiple times without changing theresult after the initial operation


6. Connectedness

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


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值