Meaning and usage of “_embedded” in HATEOAS

后端 未结 1 1550
南旧
南旧 2021-02-03 20:44

I\'m using Spring Data REST, which supports HATEOAS. I\'m new to this paradigm.

In GET responses from my RESTful web service I often receive results inside

相关标签:
1条回答
  • 2021-02-03 21:29

    There's neither a REST nor a HATEOAS specification. Both are only concepts, or architectural styles, if you will. _embedded is part of the HAL format.

    It's intended to embed (sic!) resources where otherwise only their URIs would be returned. For example GET http://localhost:8080/mywebservice/features is supposed to only return a list of URIs, like http://localhost:8080/mywebservice/features/GROUND, and you would have to load every single Feature yourself if you needed it. By utilizing _embedded all Feature resources get embedded into the response so you don't have to load them separately.

    0 讨论(0)
提交回复
热议问题