HAL和HATEOAS之间的关系和区别 [英] Relationship and difference between HAL and HATEOAS

查看:144
本文介绍了HAL和HATEOAS之间的关系和区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HATEOAS (超媒体作为应用程序状态的引擎)和 HAL (超文本应用程序语言)似乎是相关的,但不完全相同。 HATEOAS和HAL之间的关系和区别是什么?

HATEOAS (Hypermedia as the Engine of Application State) and HAL (Hypertext Application Language) seem to be related but are not exactly the same. What is the relationship and difference between HATEOAS and HAL?

推荐答案

HATEOAS是 。它定义了应用程序客户端与服务器交互的方式,通过导航他们在服务器返回的资源模型中找到的超媒体链接。

HATEOAS is a concept of application architecture. It defines the way in which application clients interact with the server, by navigating hypermedia links they find inside resource models returned by the server.

实现 HATEOAS你需要一些标准的代表资源的方式,这将包含超媒体信息(链接到相关资源),例如,像这样:

To implement HATEOAS you need some standard way of representing resources, that will contain hypermedia information (links to related resources), for example, something like this:

{
    "links": {
        "self": { "href": "http://api.com/items" },
        "item": [
            { "href": "http://api.com/items/1" },
            { "href": "http://api.com/items/2" }
        ]
    "data": [
            {"itemName":"a"}, 
            {"itemName":"b"} 
     ] 
}

HAL是其中一种标准。它是资源呈现的一种特定格式,可用于实现HATEOAS。

HAL is one of such standards. It is a specific format of resource presentation, that can be used to implement HATEOAS.

如果您喜欢遵循其他标准或使用自己的标准,您可以完全实施HATEOAS而不遵循HAL。

You can fully implement HATEOAS without following HAL at all if you prefer to follow another standard or use your own.

这篇关于HAL和HATEOAS之间的关系和区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆