A Workfront API for the Node and the Web
Install as a dependency:
npm install --save workfront-api
Then require('workfront-api')
in your code. For example:
var Workfront = require('workfront-api'),
util = require('util');
/**
* The console.log statement below will output the following:
* {
* Api: [Function: Api],
* ApiFactory: [Object],
* ApiUtil: [Object],
* ApiConstants: [Object]
* }
*/
console.log(util.inspect(Workfront, {depth:0}));
This package uses Browserify to generate dist/workfront.min.js. Loading that script will create window.Workfront
object which will contain all the classes and methods just as in the server-side environment (see Server-side section).
This package makes use of Promises. Promises are not currently supported by all browsers (see kangax compatibility tables), but there are many polyfills available, including one listed in www.promisejs.org. Load polyfill before workfront.min.js
and everything will work just fine.
Although the lack of CORS support may prevent you from sending request to Workfront servers, there are some usage examples in examples/browser folder to give you an idea.
Note, that it is still possible to make use of this package in privileged environment such as browser extensions.
API documentation is available at http://workfront.github.io/workfront-api/.
A number of examples can be found under examples directory. It includes examples for both node and browser environments.
In order to run these examples clone a copy of workfront-api repository:
git clone git://github.com/Workfront/workfront-api.git
Running node examples
First enter into workfront-api
directory and install all the dependencies:
cd workfront-api
npm install
Use node
to run the examples. For examples:
node examples/node/get-user-count.js
Each example script outputs all its results into console and contains comments in the source code explaining what is happening in more details.
Running browser examples
To start supplied webserver type:
npm start
Visit http://localhost:8000/examples/browser/ to see list of all examples available for browser.
We welcome contributions of all kinds from anyone. It can be either new example or fix or documentation improvement. Please read these guidelines:
A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful - thank you! Please make sure to check these points to make a good bug report:
- Use the GitHub issue search — check if the issue has already been reported.
- Isolate the problem — ideally create a reduced test case.
- A good bug report shouldn't leave others needing to chase you up for more information. Please try to be as detailed as possible in your report.
Feature requests are welcome. But take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible.
Copyright (c) 2015 Workfront
Licensed under the Apache License, Version 2.0.
See the top-level file LICENSE
and
(http://www.apache.org/licenses/LICENSE-2.0).