Forum Discussion

Claudius's avatar
5 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?