# modejs **Repository Path**: mirrors_mapbox/modejs ## Basic Information - **Project Name**: modejs - **Description**: node module and cli for interacting with the mode analytics api - **Primary Language**: Unknown - **License**: ISC - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-09 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README In many cases it makes more sense to query the database directly, for data in Athena, you can use the node module https://github.com/mapbox/athena to help with polling for results, or the Athena REST API directly. --- 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. 1. Get a token from https://modeanalytics.com/settings/access_tokens 1. `username` is your mode username 1. `org` is the mode org to use (defaults to username) 1. `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 /` // gets last report run. org is optional `modejs runs /` // lists runs of a report org is optional