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

  • Mastering ASP.NET Web API
  • Mithun Pattankar Malendra Hurbuns
  • 98字
  • 2021-07-02 20:52:28

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.

主站蜘蛛池模板: 汝南县| 枞阳县| 博罗县| 宁国市| 手机| 无棣县| 南开区| 镇远县| 芜湖县| 洛浦县| 桐庐县| 错那县| 高邮市| 亚东县| 岳西县| 南安市| 砚山县| 胶南市| 北安市| 平南县| 隆昌县| 旅游| 麦盖提县| 罗山县| 靖远县| 泸州市| 额敏县| 乌海市| 涪陵区| 辽阳县| 新建县| 宣化县| 轮台县| 武隆县| 巴青县| 洛阳市| 浪卡子县| 松潘县| 巩义市| 东至县| 常熟市|