Hello everyone! In response to your requests, today’s blog post is all about the JIRA API REST. We will be showing you how to create, update, and retrieve tickets using a popular API client called Postman. You can follow along with the steps in this article, and the JSON code used will be available for download on my GitHub repository. Let’s dive in!
Getting Started: Download Postman
First things first, you will need an API client to interact with the JIRA API REST. We recommend using Postman, a free, user-friendly client that supports both web-based and downloadable versions. You can use other tools, such as curl or any API JSON client, but we will focus on Postman for this tutorial.
Creating Personal Access Tokens
For authentication, we will be using token-based authentication. To generate a personal access token, log in to your JIRA Data Center or Cloud account, navigate to your profile, and click on “Personal Access Tokens” on the left-hand side. Create a new token and copy it immediately, as you cannot access it again once the dialog is closed.
Creating a Ticket Using the JIRA API REST
- Open Postman and create a new tab or task by clicking the “+” button.
- Ensure the “POST” method is selected, and enter the appropriate URL for your JIRA instance.
- Under “Authorization,” select “Bearer Token” and paste your personal access token.
- In the “Body” section, select “JSON” and paste the code from my GitHub repository, adjusting the project key and issue type as needed.
- Click “Send” to create the ticket, and check the response for the new ticket ID and key.
Adding Extra Fields and Creating Another Ticket
- Modify the JSON code in the “Body” section to include additional fields, such as “assignee” and “labels.”
- Click “Send” again to create another ticket with the added fields.
- Verify the new ticket in your JIRA instance by searching for the ticket key.
Retrieving Ticket Information
- Create a new tab in Postman and select the “GET” method.
- Enter the URL for the specific ticket you want to retrieve (e.g., DK1).
- Click “Send” to retrieve the ticket information.
- Examine the JSON response to view all the ticket details, including custom field IDs.
Adding a Comment to a Ticket
- In Postman, create a new tab and select the “POST” method.
- Enter the URL for adding a comment to the specific ticket (e.g., DK24/comment).
- In the “Body” section, paste the JSON code for adding a comment, replacing the “body” value with your desired comment text.
- Click “Send” to add the comment to the ticket.
- Verify the comment in your JIRA instance by opening the ticket and checking the comments section.
This tutorial explored the JIRA API REST and showed you how to create, update, and retrieve tickets using Postman. The JSON code used in this tutorial is available on my GitHub repository, so feel free to download it and experiment with different scenarios. Don’t forget to like, subscribe, and check out the details about our workshops and training courses in the description. Thank you for reading, and we hope to see you in the following tutorial!