JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q37987F
  • License GPL-3.0

JIRA agile REST API bridge

Package Exports

  • jira-agile-api-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (jira-agile-api-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Jira agile api client

This is a Javascript wrapper around the JIRA Software Cloud REST API.

Installation

npm install jira-agile-api-client

Setup

Node.js

var api = require('jira-agile-api-client');
var btoa = require('btoa');

// Import fetch polyfill.
global.fetch = require('node-fetch');

// Set JIRA Url.
api.setEndpoint('https://jira.example.com');

// Set login data.
api.setSetting('headers', {
  'Authorization': 'Basic '+btoa('USERNAME:PASSWORD')
});

Browser apps - online

The app either needs to be in the same domain or CORS should be set up.

var api = require('jira-agile-api-client');
api.setEndpoint('https://jira.example.com');

Browser apps - local

Start with npm run dev-server and provide jira url, your username and password. Use http://localhost:3001 as endpoint.

var api = require('jira-agile-api-client');
api.setEndpoint('http://localhost:3001');

Usage

Get day-by-day sprint statistics.

api.util.getSprintWithHistory(boardId, sprintId).then(function (result) {
  console.log(result.history);

  // result.history
  // [{
  //   "date": "2017-01-01",
  //   "stats": {
  //     "To Do": 10.5,
  //     "Done": 5,
  //     ...
  //   }
  // }, {
  //   "date": "2017-01-02",
  //   "stats": {
  //     "To Do": 9,
  //     "Done": 6,
  //     ...
  // }]

  console.log(result.sprint);
  console.log(result.issues);
}).catch(function (error) {
  console.log(error);
});

Get all boards

api.board.getList().then(function (boards) {
  console.log(boards);
}).catch(function (error) {
  console.log(error);
});

Get all sprints in a board

api.board.getSprints(boardId).then(function (boards) {
  console.log(boards);
}).catch(function (error) {
  console.log(error);
});

Create a new sprint

api.sprint.create(name, boardId).then(function (sprint) {
  console.log(sprint);
}).catch(function (error) {
  console.log(error);
});

Move issues to a sprint

api.sprint.moveIssuesToSprint(sprintId, ['TEST-1', 'TEST-2']).then(function (result) {
  console.log(result);
}).catch(function (error) {
  console.log(error);
});

See src/index.js for a full list of available methods.