Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get statistics API #89

Closed
janrudolph opened this issue Oct 11, 2017 · 4 comments
Closed

Get statistics API #89

janrudolph opened this issue Oct 11, 2017 · 4 comments

Comments

@janrudolph
Copy link

janrudolph commented Oct 11, 2017

As admin I want to get the statistics (admin/info) via an API so that I am able to crunch the data.

Note: See function _getStatistics()

@mrsimpson
Copy link
Member

This should definitely be contributed to RC.
I'm quite sure, an explicit endpoint should be provided - maybe even with an own permission.

@graywolf336
Copy link

RocketChat.API.v1.addRoute('statistics', { authRequired: true }, {
get() {
let refresh = false;
if (typeof this.queryParams.refresh !== 'undefined' && this.queryParams.refresh === 'true') {
refresh = true;
}
let stats;
Meteor.runAsUser(this.userId, () => {
stats = Meteor.call('getStatistics', refresh);
});
return RocketChat.API.v1.success({
statistics: stats
});
}
});

This is currently possible by getting GET api/v1/statistics which will refresh and return the new result or GET api/v1/statistics.list which will return the history of them.

@janrudolph
Copy link
Author

Awesome. Works pretty good. Thank you @graywolf336 !

@mrsimpson
Copy link
Member

smb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants