官术网_书友最值得收藏!

Level 3

In level 3, hypermedia is introduced into our responses, commonly referred to as HATEOAS (Hypertext As The Engine of Application State).

Let's go back to the POST example:

    POST : diet/ate  
    Response: 
    { 
      "id":"12789", 
      "links":[{ 
        "rel":"self", 
        "href":"http://yoursitename/diet/12789 
      }, 
      { 
        "Rel":"self", 
        "href":"http://yoursitename/diet/12789" 
      }, 
      "rel":"rating", 
      "href":"http://yoursitename/diet/12789/rating/" 
      ] 
    } 

The point of the link is that it lets the consumer know what actions it can carry out.

Although both endpoints look the same, the consumer will figure out that one is DELETE and the other is PUT.

The last link is the resource to rate the meal you added.

主站蜘蛛池模板: 白河县| 漳平市| 资兴市| 平泉县| 鄂尔多斯市| 信丰县| 青河县| 德江县| 蚌埠市| 涿州市| 弥渡县| 红安县| 墨江| 宁阳县| 铁力市| 广西| 湘阴县| 调兵山市| 应用必备| 青岛市| 三原县| 丰顺县| 呼和浩特市| 禄丰县| 米脂县| 博野县| 乐安县| 南部县| 赤峰市| 阳信县| 吴川市| 台前县| 贵定县| 台中县| 洮南市| 乾安县| 怀集县| 扶沟县| 靖江市| 牙克石市| 临洮县|