When you working with API Blogger, you will face an endpoint that contains much data in list.
The URL that contains a lot of data in list is :
https://www.googleapis.com/blogger/v3/blogs/your-id-blog/posts?key=YOUR_AUTH_IDThat URL will display output json look like the following image :
|Output List Json|
If you run the URL above, the result will give you only 10 datas in first page. Take a look at attribute items.
To get the next page you have to request it again (load more) and display the result as pagination. To implementing the pagination (request the next page), you can use the attribute nextPageToken. As long as the attribute nextPageToken exist, it means the data still exist in the next page.
Request the first page
Just request the first data in normal URL (without params nextPageToken). In this case i request the data using retrofit :
On the code above, I request the first page and set the data into the adapter. Don't forget to save the value of nextPageToken.
In load more function, i check the nextPageToken is exist or not. Is exist, then request the next page.
Request the next page
To request the next page, you have to add params pageToken, and the value set from nextPageToken.
The URL to be :
https://www.googleapis.com/blogger/v3/blogs/your-id-blog/posts?key=YOUR_AUTH_ID&pageToken=CgkIChjigf_aoisQu_ugxZqtye83The code is look like the follows :
That's all what i did to implementing load more pagination when request data using Blogger API. Hope it helps. Thank you.