Forum Discussion

heddend's avatar
14 years ago

Retrieving metrics using the REST API

Hi,

I want to retrieve metrics using the REST API. Can anybody provide a list of all the metrics available? I'm sure not to be the first one, collecting the metric.name's.

 

Cheers,

Dietmar

 

3 Replies

  • Here is an example from a grab I did.  This is at the user level.  You can do things at different levels (i.e. against different objects).  It's not clear exactly what you want.

     

    <response status="success">
      <metrics type="metrics" href="/users/id/111/metrics">
        <metric name="solutions_marked" type="long">1</metric>
        <metric name="agent_closed_chat_contacts" type="long">0</metric>
        <metric name="idea_bank_views" type="long">4</metric>
        <metric name="pm.page_views" type="long">0</metric>
        <metric name="deleted_blog_registered_posts" type="long">0</metric>
        <metric name="idea_views" type="long">6</metric>
        <metric name="tkb_articles" type="long">3</metric>
        <metric name="threads" type="long">5</metric>
        <metric name="video_reject_count" type="long">0</metric>
        <metric name="message_views" type="long">218</metric>
        <metric name="solved_threads" type="long">1</metric>
        <metric name="tkb_views" type="long">51</metric>
        <metric name="unpublished_tkb_articles" type="long">0</metric>
        <metric name="idea_threads" type="long">0</metric>
        <metric name="pm.body_page_views" type="long">0</metric>
        <metric name="agent_chat_contacts" type="long">0</metric>
        <metric name="deleted_idea_threads" type="long">0</metric>
        <metric name="self_solved_accepted_solutions" type="long">0</metric>
        <metric name="qanda_threads" type="long">0</metric>
        <metric name="solutions_unmarked" type="long">0</metric>
        <metric name="blog_views" type="long">0</metric>
        <metric name="kudos_events_given_revoked" type="long">0</metric>
        <metric name="kudos_weight_received" type="long">1</metric>
        <metric name="blog_registered_comments_approved" type="long">0</metric>
        <metric name="deleted_qanda_posts" type="long">0</metric>
        <metric name="image_upload_kilobytes" type="long">185</metric>
        <metric name="qanda_posts" type="long">0</metric>
        <metric name="qanda_comments" type="long">0</metric>
        <metric name="tagging_tag_count" type="long">11</metric>
        <metric name="logins" type="long">46</metric>
        <metric name="blog_registered_posts" type="long">0</metric>
        <metric name="agent_handle_time" type="long">0</metric>
        <metric name="tkb_article_publish_actions" type="long">9</metric>
        <metric name="tkb_posts" type="long">3</metric>
        <metric name="qanda_thread_page_views" type="long">0</metric>
        <metric name="deleted_qanda_answers" type="long">0</metric>
        <metric name="blog_comments_approved" type="long">0</metric>
        <metric name="deleted_overall_threads" type="long">1</metric>
        <metric name="video_upload_start_count" type="long">0</metric>
        <metric name="deleted_blog_articles" type="long">0</metric>
        <metric name="idea_page_views" type="long">26</metric>
        <metric name="kudos_events_received_revoked" type="long">0</metric>
        <metric name="image_download_count" type="long">15</metric>
        <metric name="board_views" type="long">118</metric>
        <metric name="agent_opened_contacts" type="long">0</metric>
        <metric name="agent_chat_contacts_reassigned_in" type="long">0</metric>
        <metric name="solution_revoked_threads" type="long">0</metric>
        <metric name="overall_posts" type="long">10</metric>
        <metric name="deleted_idea_posts" type="long">0</metric>
        <metric name="message_nominate_actions" type="long">1</metric>
        <metric name="avg_msg_rating_given_count" type="long">0</metric>
        <metric name="tkb_article_views" type="long">27</metric>
        <metric name="accepted_solutions" type="long">2</metric>
        <metric name="page_views" type="long">2916</metric>
        <metric name="arbitrary_points" type="long">0</metric>
        <metric name="qanda_answers" type="long">0</metric>
        <metric name="agent_live_forum_time" type="long">0</metric>
        <metric name="minutes_online" type="long">7094</metric>
        <metric name="deleted_qanda_comments" type="long">0</metric>
        <metric name="nominated_messages" type="long">1</metric>
        <metric name="author_revoked_solutions" type="long">0</metric>
        <metric name="blog_comments_recalled" type="long">0</metric>
        <metric name="posts" type="long">7</metric>
        <metric name="deleted_tkb_posts" type="long">0</metric>
        <metric name="deleted_blog_posts" type="long">0</metric>
        <metric name="deleted_threads" type="long">1</metric>
        <metric name="author_accepted_solutions" type="long">0</metric>
        <metric name="image_gallery_views" type="long">0</metric>
        <metric name="kudos_weight_given_revoked" type="long">0</metric>
        <metric name="blog_articles" type="long">0</metric>
        <metric name="revoked_solutions" type="long">0</metric>
        <metric name="agent_chat_contacts_reassigned_out" type="long">0</metric>
        <metric name="deleted_posts" type="long">1</metric>
        <metric name="tkb_article_revisions" type="long">6</metric>
        <metric name="agent_net_closed_chat_contacts" type="long">0</metric>
        <metric name="msg_rating_total" type="long">0</metric>
        <metric name="overall_threads" type="long">8</metric>
        <metric name="qanda_views" type="long">0</metric>
        <metric name="deleted_overall_posts" type="long">1</metric>
        <metric name="deleted_qanda_threads" type="long">0</metric>
        <metric name="kudos_events_received" type="long">1</metric>
        <metric name="pm.sent" type="long">0</metric>
        <metric name="kudos_weight_given" type="long">4</metric>
        <metric name="agent_help_requests_out" type="long">0</metric>
        <metric name="msg_rating_count" type="long">0</metric>
        <metric name="image_download_kilobytes" type="long">412</metric>
        <metric name="kudos_weight_received_revoked" type="long">0</metric>
        <metric name="blog_page_views" type="long">0</metric>
        <metric name="kudos_events_given" type="long">4</metric>
        <metric name="video_upload_complete_count" type="long">0</metric>
        <metric name="blog_registered_comments_recalled" type="long">0</metric>
        <metric name="contributed_posts_removed" type="long">0</metric>
        <metric name="blog_article_views" type="long">0</metric>
        <metric name="agent_help_requests_in" type="long">0</metric>
        <metric name="contributed_posts" type="long">2</metric>
        <metric name="published_tkb_articles" type="long">3</metric>
        <metric name="idea_posts" type="long">0</metric>
        <metric name="deleted_tkb_articles" type="long">0</metric>
        <metric name="pm.read" type="long">0</metric>
        <metric name="image_upload_count" type="long">1</metric>
        <metric name="avg_msg_rating_given_total" type="long">0</metric>
        <metric name="self_solved_revoked_solutions" type="long">0</metric>
        <metric name="blog_posts" type="long">0</metric>
        <metric name="tkb_comments" type="long">0</metric>
        <metric name="net_qanda_posts" type="long">0</metric>
        <metric name="net_kudos_weight_received" type="long">1</metric>
        <metric name="accepted_solutions_to_threads_ratio" type="long">50</metric>
        <metric name="net_blog_anonymous_comments_approved" type="long">0</metric>
        <metric name="responses_per_qanda" type="long">0</metric>
        <metric name="views_per_article" type="long">900</metric>
        <metric name="net_kudos_weight_given" type="long">4</metric>
        <metric name="net_blog_articles" type="long">0</metric>
        <metric name="net_posts" type="long">6</metric>
        <metric name="net_tkb_articles" type="long">3</metric>
        <metric name="net_threads" type="long">4</metric>
        <metric name="net_self_solved_accepted_solutions" type="long">0</metric>
        <metric name="net_blog_registered_comments_per_article" type="long">0</metric>
        <metric name="net_idea_comments" type="long">0</metric>
        <metric name="net_blog_anonymous_comments" type="long">0</metric>
        <metric name="net_solved_threads_to_net_threads_ratio" type="long">25</metric>
        <metric name="totalposts_per_thread" type="long">140</metric>
        <metric name="net_blog_registered_comments" type="long">0</metric>
        <metric name="other_solved_revoked_solutions" type="long">0</metric>
        <metric name="idea_comments" type="long">0</metric>
        <metric name="mod_accepted_solutions" type="long">1</metric>
        <metric name="post_productivity" type="long">0</metric>
        <metric name="qanda_responses" type="long">0</metric>
        <metric name="net_blog_registered_comments_approved" type="long">0</metric>
        <metric name="net_qanda_responses" type="long">0</metric>
        <metric name="net_kudos_events_received" type="long">1</metric>
        <metric name="deleted_idea_comments" type="long">0</metric>
        <metric name="agent_avg_chat_contacts" type="long">0</metric>
        <metric name="agent_avg_net_closed_contacts_per_hour" type="long">0</metric>
        <metric name="net_blog_comments_approved" type="long">0</metric>
        <metric name="avg_msg_rating_average" type="long">0</metric>
        <metric name="replies" type="long">2</metric>
        <metric name="blog_registered_comments" type="long">0</metric>
        <metric name="net_qanda_comments" type="long">0</metric>
        <metric name="net_blog_posts" type="long">0</metric>
        <metric name="deleted_blog_comments" type="long">0</metric>
        <metric name="net_accepted_solutions" type="long">2</metric>
        <metric name="msg_rating_average" type="long">0</metric>
        <metric name="blog_comments_per_article" type="long">0</metric>
        <metric name="blog_anonymous_comments_per_article" type="long">0</metric>
        <metric name="net_solved_threads" type="long">1</metric>
        <metric name="deleted_qanda_responses" type="long">0</metric>
        <metric name="net_tkb_comments" type="long">0</metric>
        <metric name="net_replies" type="long">2</metric>
        <metric name="view_productivity" type="long">3</metric>
        <metric name="blog_anonymous_comments_approved" type="long">0</metric>
        <metric name="deleted_tkb_comments" type="long">0</metric>
        <metric name="net_other_solved_accepted_solutions" type="long">2</metric>
        <metric name="blog_registered_comments_per_article" type="long">0</metric>
        <metric name="net_idea_threads" type="long">0</metric>
        <metric name="net_contributed_posts" type="long">2</metric>
        <metric name="mod_node_revoked_solutions" type="long">0</metric>
        <metric name="agent_avg_handle_time" type="long">0</metric>
        <metric name="comments_per_idea" type="long">0</metric>
        <metric name="blog_comments" type="long">0</metric>
        <metric name="mod_node_accepted_solutions" type="long">2</metric>
        <metric name="comments_per_article" type="long">0</metric>
        <metric name="net_idea_posts" type="long">0</metric>
        <metric name="tkb_articles_not_published" type="long">0</metric>
        <metric name="net_qanda_answers" type="long">0</metric>
        <metric name="net_comments_per_idea" type="long">0</metric>
        <metric name="agent_avg_simultaneous_contacts" type="long">0</metric>
        <metric name="other_solved_accepted_solutions" type="long">2</metric>
        <metric name="net_responses_per_qanda" type="long">0</metric>
        <metric name="net_blog_comments" type="long">0</metric>
        <metric name="net_tkb_posts" type="long">3</metric>
        <metric name="net_blog_comments_per_article" type="long">0</metric>
        <metric name="agent_net_closing_percent" type="long">0</metric>
        <metric name="net_kudos_events_given" type="long">4</metric>
        <metric name="blog_anonymous_comments" type="long">0</metric>
        <metric name="net_published_tkb_articles" type="long">3</metric>
        <metric name="net_qanda_threads" type="long">0</metric>
        <metric name="net_blog_registered_posts" type="long">0</metric>
        <metric name="avg_msg_rating_given_average" type="long">0</metric>
        <metric name="net_blog_anonymous_comments_per_article" type="long">0</metric>
        <metric name="deleted_replies" type="long">0</metric>
        <metric name="net_comments_per_article" type="long">0</metric>
        <metric name="mod_revoked_solutions" type="long">0</metric>
      </metrics>
    </response>

  • YuriK's avatar
    YuriK
    Khoros Expert
    12 years ago

    Hey mayank,

     

    The above results are a user's metrics (/users/id/[id]/metrics). There currently isn't an API call that would get you all metrics for all items in a community.

     

    The call you made gets top level community metrics. You can also make the following calls to get metrics about different objects in the community, the following are the most common:

    • categories/id/[id] /metrics - gets metrics for a category
    • boards/id/[id] /metrics - gets metrics for a board
    • users/id/[id] /metrics - gets metrics for a user

    This would mean you would have to iterate over all the objects you care about and make the metrics call for each object.

     

    There are a few suggestions already in the Customer Ideas board on how to improve how metrics work via Rest API, I would suggest kudoing the ones you like and possibly add a suggestion of your own.

     

    Hope this helps,

     

    Yuri