modejs
v1.0.0
Published
query mode analytics
Downloads
3
Readme
modejs is a library and cli for interacting with the modeanalytics.com api. Its not really documented, and might break. But this make it easier fetch data from mode and run more analysis locally.
- Get a token from https://modeanalytics.com/settings/access_tokens
username
is your mode usernameorg
is the mode org to use (defaults to username)token
is the "password" that you get when creating a token on the access_tokens page... yeah its confusing.
Use as a library
// MODEJS_USERNAME and MODEJS_TOKEN
var mode = require('modejs')({
username: '',
token: '',
org: '' //optional
});
mode.reports(function(err, reports) {
// list of reports
});
mode.report({id: '1oisdflsdf'}, function(err, report) {
// details about a report
});
// gets data from the most recent run of the report
mode.reportData({reportId: '1oisdflsdf', org: 'myorg'}, function(err, data) {
// data = JS array with an object per row.
});
// lists past runs of a report
mode.reportRuns({reportId: '1oisdflsdf'}, function(err, runs) {
// list of runs of this report.
});
Use as a cli
npm install modejs -g
modejs data <org>/<reportid>
// gets last report run. org is optional
modejs runs <org>/<reportid>
// lists runs of a report org is optional