# איך להגביל נושאים לקריאת API?

**URL:** https://meta.discourse.org/t/how-do-i-limit-topics-for-api-call/229956
**Category:** Development
**Tags:** rest-api
**Created:** [14 ביוני,‏ 2022,‏ 5:51pm UTC](https://meta.discourse.org/t/how-do-i-limit-topics-for-api-call/229956 "2022-06-14T17:51:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Razon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/razon/32/261709_2.png) [@Razon](https://meta.discourse.org/u/Razon)
#### Post date: [14 ביוני,‏ 2022,‏ 5:51pm UTC](https://meta.discourse.org/t/how-do-i-limit-topics-for-api-call/229956/1 "2022-06-14T17:51:43Z")

</div>

I’m getting all latest topics from `https://community.example.com/c/food/drinks/99.json` By default it’s load 30 topics per page if available. But i want to fetch specific number of topics like 5 topics.

How can i do this?

---

<div class="post-metadata">

### Author: ![blake](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/blake/32/157322_2.png) [@blake](https://meta.discourse.org/u/blake)
#### Post date: [14 ביוני,‏ 2022,‏ 10:42pm UTC](https://meta.discourse.org/t/how-do-i-limit-topics-for-api-call/229956/2 "2022-06-14T22:42:02Z")

</div>

Discourse doesn’t expose an api parameter to change the page size. If just fetching 30 topics but only showing 5 won’t work for you another option would be to create a custom plugin and have it override this method:

```ruby
# lib/topic_query.rb
  def per_page_setting
    DEFAULT_PER_PAGE_COUNT
  end 

```

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [27 באוקטובר,‏ 2022,‏ 6:23pm UTC](https://meta.discourse.org/t/how-do-i-limit-topics-for-api-call/229956/3 "2022-10-27T18:23:12Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
