node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Manuscript API

This package is a lightweight NodeJS wrapper around the Manuscript API.


Set Up

Require manuscript-api with your Manuscript URL and API. This is likely your best approach if you are looking to integrate with a single Manuscript account.

let mAPI = require('manuscript-api')('https://your.manuscript.url/', 'yourmanuscripttoken');

Or require it without account data and provide your data later. This will be your best approach if you are writing a single app that will interface with multiple Manuscript accounts.

let mAPI = require('manuscript-api')
let MAPI = manuscript('https://your.manuscript.url/', 'yourmanuscripttoken');

Work With the Manuscript API

Once you've required manuscript-api and passed it a Manuscript URL and token, you'll have a proxy against which you can call any endpoint of the Manuscript API. For a complete list of Manuscript API endpoints, see the documentation here.

For any api endpoint, call the name of the endpoint against your manuscript Object, and pass your parameters as an object. Under the hood, this wrapper is returning request-promise-native, and returns a promise. Choose your strategy for handling promises:

Both of the following post to http://example.manuscript.url/api/new. First we'll handle the promise:{sTitle:"Case Title"})
  .then(function(data) {

Alternatively, we can use async\await

async () => {
  let data = await{sTitle:"Case Title"});

Utility Methods


async () => {
  let isValid = await manuscript.isValid();

Returns true if we're able to authenticate to the Manuscript API with the provided credentials and false otherwise. Under the hood, this is just calling the 'logon' endpoint of the Manuscript API.

Made by Fog Creek

\ ゜o゜)ノ