Forum Discussion

AmarDoekhie's avatar
7 years ago

How do I get the total amount of post in the Community?

Hi,

 

I'm trying to find out how I can retrieve the total amount of post  on the community.

 

I tried a lot of methods, but I get very different results.

 

1. /restapi/vc/metrics/name/posts

2. Admin -> Metrics -> Overall post

3. LSI Content -> All categories -> Community structure -> Posts (I can only get 6 months of data per run)

4. api/2.0/search?q=select"count(*)" from "messages"

 

Can someone tell me what the correct way is?

 

Thanks in advanced,

 

Amar 

 

 

  • Only the Khoros gods know the answer to that, I can produce like 5 different post counts in various ways, it's quite amazing 😂, choose which one fits you the best... Which one is accurate, no clue... And "half-way" implemented new features like content archive make it even worse, it's just a theory, but I think API v1 does not have any awareness of archived content, so it might "count" all posts? But API v2 does implement content archive somewhat, and it won't return anything that you archived except you explicitly ask via a WHERE visibility_scope = 'archived' constraint, but then of course you don't get the normally visible posts, so you have to do 2 queries because visibility_scope does NOT support WHERE visibility_scope = IN('archived', 'public') constraint... but no worries, you also won't usually get back the same numbers for these two queries:

    SELECT count(*) FROM messages
    SELECT count(*) FROM messages WHERE visibility_scope = 'public'

    and even thinkering around with other visibility scopes like 'moderator' etc. and trying to get somehow to the same count, I was not successful, so please, if you find the "formula", let us know!

    There's of course also the metrics section you could try and get some more different numbers... it of course depends which metric you are querying, in your case I think relevant ones could be:

    - net_overall_posts
    - net_posts
    - deleted_posts
    - deleted_overall_posts
    - posts
    - overall_posts_excluding_spam
    - overall_posts

    • thanks luk 

      for me, only visibility_scope = 'public' works

      I got this error for all other scopes.  But that is not an access issue, right?

       

       

      {"status":"error","message":"An unexpected error occurred.","data":{"type":"error_data","code":301,"developer_message":"","more_info":""},"metadata":{}}

        

  • Are you trying to get the topics count or messgaes (reply included) count?