Skip to content
A library for working with JIRA's RESTful API, written in node.js.
JavaScript
Latest commit 6c597d7 Jul 1, 2014 @alexkappa Update package.json
Failed to load latest commit information.
lib
.gitignore Initial commit Aug 5, 2012
LICENSE Changes some structure and worked on issue Aug 6, 2012
README.md Update README.md Jul 1, 2014
index.js
package.json Update package.json Jul 1, 2014

README.md

JIRA API wrapper for Node.JS

A library for working with JIRA's RESTful API. No dependencies. So far the following resources are supported:

/rest/api/2/issue [GET, POST, PUT, DELETE]
/rest/api/2/issue/createmeta [GET]

If you wish to contribute please follow the conventions used so far, make a new directory inside lib/ named after the resource you wish to access. Thats it. Enjoy!

Installation

Install with NPM

In your application, require the library using

var jira = require('jira-api');

Usage

Get issue information

Now you're ready to make calls to the API

var options = {
    config: {
        "username": "someuser",
        "passowrd": "secretpass",
        "host": "/example.com/jira/"
    },
    issueIdOrKey: "123"
};

jira.issue.get(options, function(response) {
    console.log(JSON.stringify(response, null, 4));
});

Create an issue

You can also specify the data to send (in case of POST, PUT etc.)

var options = {
    config: {
        "username": "someuser",
        "passowrd": "secretpass",
        "host": "example.com/jira/"
    },
    data: {
        fields: {
            project: {
                key: "PROJ999",
            },
            priority: {
                name: "Critical",
            },
            summary: "A short summary of the issue",
            description: "A more elaborate decription of the issue",
            issueType: {
                name: "Improvement"
            },
            assignee: {
                name: "Bob"
            }
        }
    }
};

jira.issue.post(options, function(response) {
    console.log(JSON.stringify(response, null, 4));
});

Add an attachment

You can add an attachment to an existing issue

var options = {
    config: {
        "username": "someuser",
        "passowrd": "secretpass",
        "host": "example.com/jira/"
    },
    data: {         
        fields: {   
            issue: {
                key: "PROJ999-100"
            }       
        },          
        file: "./images/awesome-kirk2.jpg"
    }               
};

jira.issue.post(options, function(err, response) {
    if (err)
        console.error(err);
    else
        console.log(JSON.stringify(response, null, 4));
});

For a list of available request representations consult the official API documentation.

Something went wrong with that request. Please try again.