This is the best tutorial out there. It will teach you basics of how to use JIRA Cloud REST APIs. You will need a free Atlassian account to make REST API calls to JIRA Cloud.
Git clone this repo onto your computer in the destination of your choice:
git clone https://github.com/horeaporutiu/JIRA-Cloud-REST-API-Tutorial.git
then cd into the jira-cloud-tutorial folder:
cd JIRA-Cloud-REST-API-Tutorial
Run npm install
to install dependencies. Make sure to have Node.js installed!
Rename your .sample.env
to .env
and fill out the necessary env variables! See below for details
ATLASSIAN_USERNAME=horeaporutiu@gmail.com
- This should just be your email, at least it was for me
ATLASSIAN_API_KEY=ADD-YOUR-API-KEY-HERE
- Click on your account icon in top-right corner ->
Manage account
->Security
->Create and manage API token
underAPI token
. From there click onCreate API token
and add it here.
LEAD_ACCT_ID=557058:f9bcdb25-24a5-4501-927c-588
- First, run the
get-users.js
file to see your account id. The resulting JSON should give you your ID. This is needed to assign the project to a user.
DOMAIN=horeaporutiu
- This will be the
https://<your-domain>.atlassian.net
your-domain part of the URL. For example my URL ishttps://horeaporutiu.atlassian.net/
so my domain ishoreaporutiu
PROJECT_KEY=TEST22
- This can be anything
PROJECT_NAME=TestProject22
- This can be anything.
Save the file and run source .env
or another command to execute the newest contents of the .env file.
Run node app.js
to try it out! Check out the logs for results. See troubleshooting section below for help.
Have fun! Feel free to alter app.js
for it to make sense for you. Check out all of the other files
to see the details of the REST API calls!
If you run node app.js
and get the following error:
error:
{
projectName: 'A project with that name already exists.',
projectKey: "Project 'TestProject223' uses this project key."
}
Make sure you change your env variable for PROJECT_NAME and then run source .env
or another command
to make execute the newest contents of the .env file.