A node.js module, which provides an object oriented wrapper for the JIRA REST API.
This library is built to support version 3.9.1
of the JIRA Service Desk API.
JIRA Service Desk API documentation can be found here
Install with the node package manager npm:
$ npm install build-jira
const JiraApi = require('build-jira').jira;
const jira = new JiraApi({
host: <your-jira-host>,
username: <jira-user>,
password: <jira-user-password>
});
/* For servicedeskInfo input is not required, hence first parameter is null in this call. */
jira.serviceDeskInfo(null, (error, body) => {
console.log('RESPONSE: ', error, body);
});
/* If start and limit is not passed, then default values 0 and 10 will get applied respectively */
jira.getAllServiceDesks({ start: 0, limit: 10 }, (error, body) => {
console.log('RESPONSE: ', error, body);
});
jira.getServiceDeskById(<service-desk-id>, (error, body) => {
console.log('RESPONSE: ', error, body);
});
let input = {
serviceDeskId: <service-desk-id>,
requestTypeId: <request-queue-id>,
summary: <your-ticket-title>,
description: <explanation-about-ticket>
};
jira.createServiceDeskTicket(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
/* If start and limit is not passed, then default values 0 and 10 will get applied respectively */
/*
NOTE: HERE input IS NOT MANDATORY
IF YOU PASS IT THEN IT WILL RETURN DATA ACCORDINGLY
ELSE IT WILL RETURN DEFAULT DATA
*/
let input = {
start: <start-index>,
limit: <number-of-records-to-return>,
requestOwnership: <ticket-ownership-type>,
requestStatus: <request-ticket-status>,
searchString: <string-to-get-matching-records>,
serviceDeskId: <servicedeskid-to-get-records>
};
jira.getAllRequestsOfCustomer(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
jira.getCustomerRequestById(<issue-id-key>, (error, body) => {
console.log('RESPONSE: ', error, body);
});
let input = {
serviceDeskId: <service-desk-id>,
issueId: <issue-id-to-add-attachment>,
file: [<array-of-file-paths-to-attach>],
comment: <comment-to-add-for-attachment-if-any>
};
jira.createCustomerAttachment(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
let input = {
issueId: <issue-id-to-add-attachment>,
comment: <comment-to-add>
};
jira.addCommentOnCustomerRequest(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
/* If start and limit is not passed, then default values 0 and 10 will get applied respectively */
let input = {
start: <start-index>,
limit: <number-of-records-to-return>,
issueId: <issue-id-to-add-attachment>
};
jira.getCommentsOnCustomerRequest(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
/* If start and limit is not passed, then default values 0 and 10 will get applied respectively */
let input = {
start: <start-index>,
limit: <number-of-records-to-return>,
issueId: <issue-id-to-add-attachment>
};
jira.getCustomerRequestStatus(input, (error, body) => {
console.log('RESPONSE:', error, body);
});
jiraApi options:
host<string>
: The hostname for your jira serveruser<string>
: The username to log in withpassword<string>
: Keep it secret, keep it safe
-
Service Desk
- Infomation
- Get All Service Desks
- Get Service Desk By Id
- Create New Ticket In Service Desk
- Get All Requests Of Customer
- Get Customer Request By Id
- Create Attachment To Customer Request
- Add Comment on Customer Request
- Get All Comments On Customer Request
- Get Customer Request Status (Current And History)
- 1.0.8 addCommentOnCustomerRequest, getCommentsOnCustomerRequest, getCustomerRequestStatus functions added, and other changes
- 1.0.6 createCustomerAttachment function added
- 1.0.5 getAllRequestsOfCustomer, getCustomerRequestById functions added and Javascript Standard Style Guid applied
- 1.0.4 README updated
- 1.0.3 createServiceDeskTicket function added
- 1.0.2 serviceDeskInfo parameter corrected
- 1.0.1 READEME file added
- 1.0.0 Initial version