This guide provides examples of using the jira.js
library to interact with Jira's API. These examples will help you get started with common operations like creating a project, adding a task, adding a worklog, and retrieving all worklogs.
Before you start running the examples, make sure to complete the following steps:
- Install Dependencies: The examples require certain Node.js packages to run. Install these dependencies by running the command:
npm i
- Setup Credentials: The jira.js library uses your Jira's
host
,email
, andapiToken
to authenticate requests. Specify these in thesrc/credentials.ts
file:
const host = 'https://your-domain.atlassian.net';
const email = 'YOUR_EMAIL';
const apiToken = 'YOUR_API_TOKEN';
Here are some examples of what you can do with jira.js
:
This example creates a new project and a new task in that project.
To run this example, use the command:
npm run basic
This example creates a new task in the first project it finds and adds a worklog to it.
To run this example, use the command:
npm run addWorklog
This example creates a new task, adds a worklog to it, and then retrieves all the worklogs that have been added to the task.
To run this example, use the command:
npm run getAllWorklogs