How do I limit topics for API call?

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?

1 Like

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:

# lib/topic_query.rb
  def per_page_setting
    DEFAULT_PER_PAGE_COUNT
  end 
1 Like

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