Forum Discussion

erickwang's avatar
erickwang
Contributor
6 years ago

How to get the total number of many kinds of views for a unique user? IE. Topic View...

How can I get the total topic number and total reply number for a unique user?

May I get help from some one that how can I get the numbers of some kinds of views for a unique user? I want to get the total numbers of Board View, Topic View, Accepted Solution View, Article View, Idea View, Blog Read and Comment.

Could you provide the logic and which APIs could I use to get those numbers?

7 Replies

  • erickwang 
    For topic count 

    SELECT count(*) FROM messages where author.id = '7' and depth = 0

    For reply count

    SELECT count(*) FROM messages where author.id = '7' and depth > 0

    But unfortunately, there is no API to get the view count for a specific user. 

  • erickwang's avatar
    erickwang
    Contributor
    6 years ago

    Thanks for your quick reply. If we don't get the view count for a specific user, can we get the total number of Board View, Topic View, Accepted Solution View, Article View, Idea View, Blog Read and Comment for all the user? 

  • VikasB's avatar
    VikasB
    Boss
    6 years ago

    erickwang 

    For board/blogs/idea view count

     

    SELECT views FROM boards where id = 'B1'

     

    Read count for all messages 

     

    community.lithium.com/community-name/restapi/vc/boards/id/[id]/messages/read/count

     

     Messages/article view count

     

    communtiy.lithium.com/community-name/restapi/vc/messages/id/[id]/views/count

     

    read count

     

    community.lithium.com/community-name/restapi/vc/threads/id/[id]/messages/read/count

     

    Hope these APIs will help you. 

  • erickwang's avatar
    erickwang
    Contributor
    6 years ago

    I attached an screenshot. May I know how can I get these information?

    request.png

  • JakeR's avatar
    JakeR
    Khoros Oracle
    6 years ago

    If I am not mistaken, I believe this page contains all of the fields that can be used for the data that is available in a profile.  You should be able to construct the appropriate Calls from the content shared in that article, given what VikasB has shared so far.

    Please let me know if this helps.

  • Does anyone know if the latest API provides those numbers?

    I tried using the v2 user endpoint, in the metric section only gives me something like this.

     

            "metrics": {
                "type": "user_metrics",
                "logins": 15,
                "minutes_online": 5,
                "posts": 2527,
                "private_messages_received": 4,
                "private_messages_sent": 0,
                "page_views": 64,
                "messages_read": 1
            },

     

    There are no Total Solutions Marked Accepted, the topic started number, and replies number. They combined it into "posts".

  • rosdyana these are the default metrics returned, there are 1000's of metrics keys, but if you want specific ones you have to query them explicitly:

    SELECT id, value FROM metrics WHERE id IN('net_accepted_solutions', 'net_idea_threads', 'net_kudos_events_given', 'net_kudos_events_received', 'net_overall_posts', 'net_overall_replies', 'net_overall_threads') AND user.id = '<userid>'

     

    you might wanna look at this post of mine https://community.khoros.com/t5/Developer-Discussion/Community-Metrics-Keys-List/m-p/745218 where I posted all metrics keys from different sources that I could find...