How to get all posts by one request

Is it possible to get all posts by one request?

Hi @rdmitrij - normally multiple posts are retrieved based on community feed / user feed / global feed so you can retrieve all posts from those feeds based on query API: Feed & Timeline - Amity Docs
However if want to query list of all posts that’s not currently possible. I would like to know a bit more on your use case though since normally these requirements are more for analytics / admin purpose – if that is the case we suggest you use our Webhook Events service to sync all posts creation and other activities to external data system: Webhook Events - Amity Docs

I have a page with playlist cards. For each playlist card, I create a post with a custom data type in Amity.

PostRepository.createPost({
    targetId: 'AMITY_COMMUNITY_ID',
    targetType: 'community',
    dataType: 'CUSTOM_DATA_TYPE',
    data: { id: playlist.id },
  });

On the playlist cards page, I want to show the comments count for each playlist(post).

  • The number of card might be more than 20
  • I know only one way to find a post related to playlist card (to fetch all posts and filter them by rule: data.id === playlist.id)
    That’s why I need all playlists.

Since all playlist is tied to a post inside Community AMITY_COMMUNITY_ID In this case you can use Query group feed - Feed & Timeline - Amity Docs - to query all posts from AMITY_COMMUNITY_ID ?

Yes, sure. I can use .queryCommunityPosts method but it returns only 20 latest posts.
I mentioned that the number of cards(posts) might be more than 20.

I would suggest to implement pagination: Feed & Timeline - Amity Docs to load next pages as users scroll down the list. Loading all posts at once won’t scale really well as posts list grow, so pagination and infinite scroll should do the trick

Thank you, I will look for another solution