npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

microstrategy

v0.1.16

Published

A node.js wrapper for the MicroStrategy REST API & Task API

Downloads

12

Readme

MicroStrategy REST API npm version npm size npm downloads

NPM Publish CodeFactor

A light npm wrapper around some of the MicroStrategy REST API endpoints.

Dependencies

HTTP requests are handled by axios, the promise based HTTP client for the browser and node.js.

Installation

Node Environments

npm

npm i microstrategy --save

yarn

yarn add microstrategy

HTML Pages

This module can be used on any HTML page using the bundled dist/mstrapi.min.js file. Simply include this script tag on any page:

<script src="https://cdn.jsdelivr.net/npm/microstrategy/dist/mstrapi.min.js" crossorigin="anonymous"></script>

See ./webpack for documentation on the bundling process.

Once loaded via the script tag, this API module can be accessed via a global object called mstrapi:

    const baseUrl = 'http://aps-tsiebler-vm:8080/2020u1Library/api';
    const mstrClient = new mstrapi.REST({
      baseUrl: baseUrl
    });

See ./samples/html/cdn-login.html for an example.

MicroStrategy REST API

  • Import the module and create a new instance of the REST client.
  • Provide a URL to your MicroStrategy Library REST API via the baseUrl parameter.
  • Login & Logout methods are exposed on the REST client. Other methods are grouped by topic.
  • Every REST method returns a Promise, making this library async await ready.
  • By default, your session state headers are stored and persisted by your client instance.
const mstr = require('microstrategy');

(async () => {
  const baseUrl = 'http://aps-tsiebler-vm:8080/2020u1Library/api';
  const mstrClient = new mstr.REST({
    baseUrl: baseUrl
  });

  await mstrClient.login({
    username: 'Administrator',
    password: '',
    loginMode: 1
  });

  // MicroStrategy Tutorial
  const projectId = 'B19DEDCC11D4E0EFC000EB9495D0F44F';
  mstrClient.setProjectId(projectId);

  const dossierId = 'C103CFA847057FC9FCF772ADF9092BD9';

  // APIs are grouped by topic
  const DossierAPI = mstrClient.dossiersAndDocuments;
  const dossierDefn = await DossierAPI.getDossierDefinition(dossierId);
})();

REST API Documentation

These methods are simpler wrappers around the APIs exposed by the MicroStrategy Library REST API server. For full documentation, refer to your MicroStrategy Library's api-docs endpoint.

For example, if your MicroStrategy Library environment has the following URL:

http://example.com/MicroStrategyLibrary/

Your API documentation can be found here:

http://example.com/MicroStrategyLibrary/api-docs

For public REST API documentation from the MicroStrategy demo environment, refer to the following URL: https://demo.microstrategy.com/MicroStrategyLibrary/api-docs

More REST API Samples

Refer to the samples folder for more samples tested in node.js. These can be directly executed using the node command:

node samples/getDossier.js

Missing REST APIs

If you notice any missing endpoints, please contribute with a PR to enhance this module.

MicroStrategy Task API

This module includes a minimal wrapper to execute tasks via the Task API.

  • Import the module and create a new instance of the TaskAPI client.
  • Provide a URL to your MicroStrategy Web taskProc via the taskProcUrl parameter.
  • Build a request via the executeTask() method.
const mstr = require('microstrategy');

(async () => {
  const taskApi = new mstr.TaskAPI({
    taskProcUrl: 'http://aps-tsiebler-vm:8080/2020u1/servlet/taskProc'
  });

  const taskId = 'login';

  // Collect these from the task builder page
  const taskParameters = {
    server: 'aps-tsiebler-vm',
    project: 'MicroStrategy Tutorial',
    userid: 'administrator',
    password: ''
  };

  // The response includes { body, headers, status, statusText }
  try {
    const res = await taskApi.executeTask(taskId, taskParameters);
    console.log('task response: ', res.body);
  } catch (e) {
    console.error(e);
  }
})();