Installing

First, make sure you have node (v5+) installed, see Setting up node environment for instructions.

Usage with Webpack or Browserify

Install the package using NPM:

npm install --save git+http://bitbucket.org/ftrack/ftrack-javascript-api.git

You can then import or require the ftrack-javascript-api package:

var ftrack = require('ftrack-javascript-api');
var session = new ftrack.Session(...)

Or, using ES2015-style imports:

import { Session } from 'ftrack-javascript-api';
var session = new Session(...);

Usage with Node

To use the API with node, you will need to install the a polyfill for the fetch API, isomorphic-fetch:

npm install --save isomorphic-fetch git+http://bitbucket.org/ftrack/ftrack-javascript-api.git

Require isomorphic-fetch to add the polyfill, then require the API and instantiate a Session.:

require('isomorphic-fetch');
var ftrack = require('ftrack-javascript-api');
var session = new ftrack.Session(...)

Note

Using the event hub from Node is currently not supported.

Building distribution bundle from source

You can also build manually from the source for more control. First, make sure you have node (v5+) installed, see Setting up node environment for instructions.

Obtain a copy of the source by either downloading the zipball or cloning the public repository:

git clone git@bitbucket.org:ftrack/ftrack-javascript-api.git

Then you can build the package

npm install
npm run dist

and run the tests with:

npm run test

Building documentation from source

To build the documentation from source:

python setup.py build_sphinx

Then view in your browser:

file:///path/to/ftrack-javascript-api/build/doc/html/index.html

Dependencies building docs

Setting up node environment

You will need a recent version of nodejs (5+) with npm installed. It is highly recommended that you also install a version manager for node, such as n (Mac OS) or nodist (windows). It enables you to use different node versions in different projects.