【发布时间】:2019-11-27 13:57:20
【问题描述】:
在 json:api 规范的Resource Linkage section 中,我发现你可以使用这样的 url 获取相关资源对象,http://example.com/articles/1/author,引用“id 为 1 的文章的作者”。
在站点完整示例中,我们可以看到作者的 id 为 9。
// ...
{
"type": "articles",
"id": "1",
"attributes": {
"title": "Rails is Omakase"
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
},
"data": { "type": "people", "id": "9" }
}
},
"links": {
"self": "http://example.com/articles/1"
}
}
// ...
所以,如果我理解它,我将能够使用两个不同的 url 请求相同的资源:
http://example.com/articles/1/author
http://example.com/authors/9
这样好吗?
这不考虑duplicate content吗?
【问题讨论】:
标签: api duplicates json-api