Forum Discussion

Parvez_AL's avatar
Parvez_AL
Advisor
5 years ago

How to find total number of topics in a particular board

Hi,

I am not very technical but can make basic RestAPI calls. I know to get the total number of topics in the community i can use http://community-name/restapi/vc/topics/count

Similarly how can i find the total number of overall topics in a particular board using the board id.  

  • Parvez_AL 

     

    you can use this V1 API and pass board id to it.

     

    https://community.lithium.com/restapi/vc/boards/id/[id]/topiclist
    
    https://community.lithium.com/restapi/vc/boards/id/[id]/topics/count 

     

     

    by default this will return 25 topics, to get maximum you need to pass pageSize parameter to get the more records.

    Returns a list of topics (thread root messages) in this board. The number of topics returned is specified by pageSize, and if the number of topics is greater than the page size, the start of the list is specified by pageNumber

     

    You can also use V2 API:

     

    SELECT count(*) FROM messages where board.id='[your_board_id]' AND depth=0
    SELECT * FROM messages where board.id='[your_board_id]' AND depth=0

     

     

    This will also give the same results, and you can pass limit at the end of query  to get more records you need to show.

    SELECT * FROM messages where board.id = '[your_board_id]' AND AND depth = 0 LIMIT 10