steves / node-jira

A nodejs wrapper for the JIRA REST API
378 stars 169 forks source link

JavaScript JIRA API for node.js

Build Status

A node.js module, which provides an object oriented wrapper for the JIRA REST API.

This library is built to support version 2.0.alpha1 of the JIRA REST API. This library is also tested with version 2 of the JIRA REST API. It has been noted that with Jira OnDemand, 2.0.alpha1 does not work, devs should revert to 2. If this changes, please notify us.

JIRA REST API documentation can be found here

Installation

Install with the node package manager npm:

$ npm install jira

or

Install via git clone:

$ git clone git://github.com/steves/node-jira.git
$ cd node-jira
$ npm install

Examples

Create the JIRA client

JiraApi = require('jira').JiraApi;

var jira = new JiraApi('https', config.host, config.port, config.user, config.password, '2.0.alpha1');

Find the status of an issue

jira.findIssue(issueNumber, function(error, issue) {
    console.log('Status: ' + issue.fields.status.name);
});

Currently there is no explicit login call necessary as each API call uses Basic Authentication to authenticate.

Get an issue remote links

Returns an array of remote links data.

jira.getRemoteLinks(issueKey, function(err, links) {
    if (!err) {
        console.log(issueKey + ' has ' + links.length + ' web links');
    }
});

Create a remote link on an issue

Returns an array of remote links data.

// create a web link to a GitHub issue
var linkData = {
    "object": {
        "url" : "https://github.com/steves/node-jira/issues/1",
        "title": "Add getVersions and createVersion functions",
        "icon" : {
            "url16x16": "https://github.com/favicon.ico"
        }
    }
};

jira.createRemoteLink(issueKey, linkData, function (err, link) {

});

More information can be found by checking JIRA Developer documentation.

Options

JiraApi options:

Implemented APIs

TODO

Changelog