how can I use the “RKPaginator” with a custom “page paramter? My API doesn’t provide a “page” param, it uses a pattern like this for pagination:
“http://my.domain.com/api/lists/?limit=5&offset=10”
“offset” is the param for the next page.
The JSON return form my API looks like this:
"meta": {
"next": "/api/lists/?limit=5&offset=15",
"total_count": 22,
"previous": "/api/lists/?limit=5&offset=5",
"limit": 5,
"offset": 10
},
Or would it be easier to customize tastypie to handle requests like this?
“http://my.domain.com/api/lists/?page=1”
Which methods I’ve to override?
Thanks a lot.
Override the RKPaginator::loadPage method with a objective-c category and calculate the offset from the page number and limit as shown in the following lines of code:
And here comes the construction of the RKPaginator object: