我想知道 json 是否可以部分分页。
例如
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever."
}
}],
"included": [
{
"type": "people",
"id": 42,
"attributes": {
"name": "John"
}
},
{
...annnd 80000 others
}
}
]
}
哪里included
有太多元素(例如 80.000 个)而不是我们需要分页?但是如果它是分页的并且我们继续下一页只有included
元素会改变,json 仍然会返回 data.articles。
这是正确的行为吗?
第一个提案:
{
"data": [{
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON API paints my bikeshed!",
"body": "The shortest article. Ever."
},
"relationships": {
"users": {
"link": "https://website.com/api/v1/articles/1/users.json"
}
}
}]
}