-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Consider this example where a GET request to https://example.org/blog-post at one point in time responded with (situation A):
{
"_links": {
"self": { "href": "https://example.org/blog-post" },
"author": { "href": "https://example.org/people/alan-watts" }
},
"_embedded": {
"author": {
"_links": {
"self": { "href": "https://example.org/people/alan-watts" }
},
"name": "Alan Watts",
"born": "January 6, 1915",
"died": "November 16, 1973"
}
}
}And some while later (or earlier) with (situation B):
{
"_links": {
"self": { "href": "https://example.org/blog-post" },
"author": { "href": "https://example.org/people/alan-watts" }
}
}If you consider the Hypertext cache pattern, you could see the embedding as an optional optimization, and your client code shouldn't have to check whether a "rel" is embedded or not for every possible resource.
So for example Resource("https://example.org/blog-post").author.name is the same for both situation A and B (but in situation B it would result in an extra request being done).
See also https://github.com/gamache/hyperresource as a (Ruby) example of one way this distinction can be avoided in client code.
Metadata
Metadata
Assignees
Labels
No labels