Paginate sub-resources in Spring Data Rest 2.1

I am using Spring Data Rest 2.1.1 Release with default setting. Given the following resource:

GET /communities/MyCommunity

{
    "creationDate": "2014-07-16T06:22:37.153+0000",
    "name": "GroupeSEB",
    "_links": {
        "self": {
            "href": "http://localhost:8080/api/communities/GroupeSEB"
        },
        "posts": {
            "href": "http://localhost:8080/api/communities/GroupeSEB/posts"
        }
    }
}

When I get the posts sub-resource:

GET /communities/MyCommunity/posts

{
    "_embedded": {
        "posts": [
            {
                "creationDate": "2014-07-09T13:09:14.535+0000",
                "id": "53bd3efae4b012818368c549",
                "_links": {
                    "self": {
                        "href": "http://localhost:8080/api/posts/53bd3efae4b012818368c549"
                    } 
                }
            }
        ]
    }
}

No pagination. Since my parent resource can aggregate a large number of messages (its sub-resource), how can I enable pagination for all sub-resources?

+4
source share
1 answer

The answer is quite simple: you cannot. Here is the rationale:

. . , , , . . .

, , . , , , .

, , .

+1

Source: https://habr.com/ru/post/1548599/


All Articles