Reputation: 907
I'm making the following request:
https://www.googleapis.com/blogger/v3/blogs/(blogId)/posts/search?key=(myKey)&q=(someSearchTerm)
and I'm getting 10 items at the result and a nextPageToken
field.
How can I get the next 10 items with this page token?
update
when i add the nextPageToken
string with the parameter pageToken
to the url like so:
https://www.googleapis.com/blogger/v3/blogs/(blogId)/posts/search?key=(myKey)&q=(someSearchTerm)&pageToken=(stringOfNextPageToken)
nothing happens and i get the same 10 items.
Upvotes: 3
Views: 1661
Reputation: 2473
Definitely, it's not a bug, though it needs more clarification, you can refer to this document from Blogger API v3 here.
to get the pagination work you need to call the API with maxResults={pageSize} then you will get an extra value in the response 'nextPageToken', you should use the value of this field and pass it with. 'pageToken' NOT 'nextPageToken'
https://blablabla?maxResults=10&pageToken={VALUE_OF_NEXTPAGETOKEN}
when you reach the end of the list you won't get the nextPageToken anymore and it means nothing more to fetch.
Upvotes: 0
Reputation: 263
When using:
{Google API URL}/posts/?{parameters}&pageToken={nextPageToken}
JSON data response contains the next items. Which is the expected behavior, as described in Pagination in Blogger Api V3.
But when using :
{Google API URL}/posts/search/?{parameters}&pageToken={nextPageToken}
JSON data response contains the same items again. Looks like pageToken
is ignored by /posts/search/
.
I opened an issue in Google API Github.
Updated :
In the mean time, I'm using standard Blogger feeds {Blog URL}/feeds/posts/
and forgot about using the Google API v3.
Upvotes: 1