Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
View allows to create pagination but there is no provision to access the same mechanism in REST interface. Consider the following example :
Here a REST export is created on path /comments/%nid and it returns JSON list of comments for nid given. Here I pager is enabled then it only show specified number of items, for this example it is 10.
Proposed resolution
- The best solution according to REST full standard is that URL for accessing next and previous page i.e 10 JSON objects is given in
"_links":
filed of response JSON so that application developer can use it and implement efficient paging mechanism. - Or the path for this kind of view should be designed like
/comments/%nid/%nextItemNumber
so here application developer can specify the number of item from where application is left to download the information i.e on first request it can be like/comments/5/0
then it will return 10 comments ( this number is configured by admin view via PAGER ) then subsequently it can request/comments/5/10
etc. Please give a well documented example for how to create such paths for REST view export.
Comment | File | Size | Author |
---|---|---|---|
paging.png | 108.66 KB | vivekvpandya |
Comments
Comment #2
Wim LeersComment #3
Wim LeersThis is actually just a duplicate of #2099281: [PP-1] REST views: pagination link relations, which is almost two years older.