# How to get all posts by one request

**URL:** <https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376>\
**Category:** Web\
**Created:** [January 11, 2022, 11:18am UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376 "2022-01-11T11:18:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdmitrij](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/rdmitrij/32/174_2.png) [@rdmitrij](https://forum.social.plus/u/rdmitrij)\
**Post date:** [January 11, 2022, 11:18am UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/1 "2022-01-11T11:18:48Z")

</div>

Is it possible to get all posts by one request?

---

<div class="post-metadata">

**Author:** ![touchaponk](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@touchaponk](https://forum.social.plus/u/touchaponk)\
**Post date:** [January 11, 2022, 1:05pm UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/2 "2022-01-11T13:05:29Z")

</div>

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](https://docs.amity.co/social/web/feed-and-timeline)  
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](https://docs.amity.co/beta-features/real-time-events)

---

<div class="post-metadata">

**Author:** ![rdmitrij](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/rdmitrij/32/174_2.png) [@rdmitrij](https://forum.social.plus/u/rdmitrij)\
**Post date:** [January 12, 2022, 4:35pm UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/3 "2022-01-12T16:35:40Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![touchaponk](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@touchaponk](https://forum.social.plus/u/touchaponk)\
**Post date:** [January 12, 2022, 4:42pm UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/4 "2022-01-12T16:42:46Z")

</div>

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](https://docs.amity.co/social/web/feed-and-timeline#query-group-feed) - to query all posts from `AMITY_COMMUNITY_ID` ?

---

<div class="post-metadata">

**Author:** ![rdmitrij](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/rdmitrij/32/174_2.png) [@rdmitrij](https://forum.social.plus/u/rdmitrij)\
**Post date:** [January 12, 2022, 5:11pm UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/5 "2022-01-12T17:11:19Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![touchaponk](https://avatars.discourse-cdn.com/v4/letter/t/ec9cab/32.png) [@touchaponk](https://forum.social.plus/u/touchaponk)\
**Post date:** [January 12, 2022, 5:31pm UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/6 "2022-01-12T17:31:53Z")

</div>

I would suggest to implement pagination: [Feed & Timeline - Amity Docs](https://docs.amity.co/social/web/feed-and-timeline#implementing-feed-pagination) 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

---

<div class="post-metadata">

**Author:** ![rdmitrij](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.social.plus/rdmitrij/32/174_2.png) [@rdmitrij](https://forum.social.plus/u/rdmitrij)\
**Post date:** [January 13, 2022, 9:38am UTC](https://forum.social.plus/t/how-to-get-all-posts-by-one-request/376/7 "2022-01-13T09:38:06Z")

</div>

Thank you, I will look for another solution
