Forum Discussion

Claudius's avatar
6 years ago

Empty 'metrics' field in API v2 'users' collection

We are trying to pull certain relevant metrics for all of our community users in order to feed them into an external dashboard💹. The majority of the metrics (kudos, solutions, registration date) are directly exposed in the API v2 'users' collection. Some of them - total sign-ins, minutes online, ... - are not to be found there, but it seems they can only be obtained from the 'metrics' collection (E.g. SELECT * FROM metrics WHERE id IN ('logins','minutes_online') AND user.id = '65'). Unfortunately, that doesn't scale nicely to obtain the metrics for all members. 🤔

So looking back to the 'users' collection, I found a 'metrics' field which is documented as "The metrics of the user activity" and should be returning a "user_metrics" object. That sounds great 🎉 Unfortunately what the API returns is literally that 😑, e.g. for SELECT metrics FROM users WHERE id = '65' I get:

      "metrics" : {
        "type" : "user_metrics"
      }

Any advice on the right syntax to query additional metrics from the 'users' collection?

2 Replies

  • Claudius's avatar
    Claudius
    Boss
    6 years ago

    Hi Rohit,

    That's a pity we can't use API v2 for that. 🙁 The v1 method is not an alternative since it only returns community-wide metrics, but not those on user level.

    SuzieH JohnD Is it worth removing the empty 'metrics' field from the v2 documentation then to avoid more people attempting this in vein?