This is my python script to create jira ticket, but i am getting an error

arunkumarnalladi
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
April 5, 2023
import xml.etree.ElementTree as ET
import requests
import getpass

# Jira authentication
jira_username = ""
jira_api_key = getpass.getpass("E")
jira_project_key = ""

# Parse XML report
tree = ET.parse('/home/mahiratechnology/Videos/Mccain-Jira/report.xml')
root = tree.getroot()

# Loop through the XML elements and create a Jira issue for each one
for element in root:
# Get the summary and description for the issue from the XML element
summary = element.find('summary').text
description = element.find('description').text
# Create the Jira issue payload
issue_data = {
"fields": {
"project": {"key": jira_project_key},
"summary": summary,
"description": description,
"issuetype": {"name": "Task"}, # Set the issue type to Task
"assignee": {"name": jira_username}
}
}
# Send the request to create the Jira issue
response = requests.post(jira_api_url, json=issue_data, auth=(jira_username, jira_api_key))
# Print the response to the console
print(response.json())
my error : {'errorMessages': ['You do not have permission to create issues in this project.'], 'errors': {}}

1 answer

0 votes
Naveen Kumar_Appfire
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 5, 2023

Hi @arunkumarnalladi

Here is the REST API to create the issue https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

Also, check your create permissions in that project?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events