Forum Discussion

cike's avatar
cike
Champion
11 years ago

Getting all recent topics via REST API

Hi,

I'm trying to modify the output of the recent topics component (in Studio it is named as "post-list") within the recent topics page with a custom component using the REST API and jQuery. Everything I developed works fine, but it seems that my REST API call hasn't the correct/full data I need.

 

I make a REST API call to retrieve all recent topics in my community ("/topics/recent?restapi.response_style=view"). The response includes 25 messages as result, but a call of "/topics/recent/count" tells me, that there are 200+ recent topics in my community.

 

Is it possible to modify my REST API call to get all recent topics in my community or is this some kind of limitation by Lithium?

 

Thanks for your help and best regards.

Christian

  • Hi cike 

     

    you need to to specify a additional parameter named "page_size", e.g. "/topics/recent?restapi.response_style=view&page_size=100", otherwise, default page size, i.e. 25 will be used.  

     

    to get the next page, just pass another parameter "page", e.g.  "/topics/recent?restapi.response_style=view&page_size=100&page=2" will list topic #101 to topic #200.

  • HaidongG's avatar
    HaidongG
    Lithium Alumni (Retired)

    Hi cike 

     

    you need to to specify a additional parameter named "page_size", e.g. "/topics/recent?restapi.response_style=view&page_size=100", otherwise, default page size, i.e. 25 will be used.  

     

    to get the next page, just pass another parameter "page", e.g.  "/topics/recent?restapi.response_style=view&page_size=100&page=2" will list topic #101 to topic #200.

    • cike's avatar
      cike
      Champion

      Hi HaidongG ,

       

      thanks. That was exactly the parameter I forgot to set for my calls. :smileyhappy: