๐พCreate Jira Issue
In this article, I would be showing you how to create a Jira issue using the "go-atlassian" library.
Step 1: Set up the project
Create a new directory for your project.
Open a terminal and navigate to the project directory.
Initialize a new Go module using the following command:
Step 2: Install the "go-atlassian" library
In the terminal, run the following command to install the "go-atlassian" library:
Step 3: Import the necessary packages
Create a new Go file (e.g.,
main.go
) in your project directory.Open the file and import the required packages:
You can use the V2 and V3 Jira endpoint versions.
Step 4: Authenticate with Jira
In the main
function, create a new Jira client and authenticate using your Jira URL, username, and API token:
Step 5: Custom fields definition
OPTIONAL, you can define custom-fields values you want to set on the issue creation. This library supports the following custom-fields types:
Step 6: Create an issue
Create a new issue using the Create
method and set the custom fields:
Make sure to replace YOUR_PROJECT_KEY
with the actual project key, and set the appropriate values for the other required fields like Summary
, Type
, Assignee
, Reporter
, etc.
Step 7: Run the program
Save the
main.go
file.In the terminal, navigate to your project directory.
Execute the following command to run the program:
This will create a new issue in Jira with the specified custom field values. Please note that you may need to modify the code according to your specific Jira configuration and custom field types.
Last updated