Im confused. How to use pagination? do I need to add token to get the next page? where can i get the token.
Hello, @Arone_Jerome Welcome to the Sendbird community!
Yes, you need to add a token parameter. Consider the below example:
Platform API allows you to get the list of all your channels.
Call GET → https://api-{application_id}.sendbird.com/v3/group_channels/?limit=100&show_members=true
Reference: Overview | Chat Platform API | Sendbird Docs
This will get 100 channels. If you have more than 100, then Sendbird will send you a “next” attribute: something like this
“next”: “ZnsURFdUQVJHXERECA0cTj0tTBwCChxxxxxx”
This means that you still have more information to retrieve. You need to call the same URL again but adding a “token” parameter.
GET → https://api-{application_id}.sendbird.com/v3/group_channels/?limit=100&show_members=true&token=ZnsURFdUQVJHXERECA0cTj0tTBwCChxxxxxx
And you get the list of the following channels. Once the “next” attribute is empty, it means that you received all the information and there’s nothing more to get.
“next”:“”
Let me know if this helps.
Hi @Chinmaya_Gupta .But i’m using the package sendbird_sdk for flutter. Do I still need to do API request before getting the next page of GroupChannelListQuery() ?
Hello, I think I got it na. My mistake is adding the GroupChannelListQuery() inside the action. The loadNext() is always getting a new instance. We should put it outside so that the .loadNext() function will get the next set of data. Thanks for your time @Chinmaya_Gupta