I am unable to get jira instance for my issue

Mallika Nandikotkur March 13, 2024

Hi,

I have joined Atlassian Jira Software with Standard Plan.

I have created a project called QTIM and created an issue under that. I have created API Token as well.

I am trying to get jira instance of my issue with below python code.

 

jira_options = {
'server': jira_url,
'auth': (jira_email, jira_api_token)
}

try:
jira_client = JIRA(options=jira_options)
print(jira_client.user) # Example API call using the client
print("Getting issue")
# Get all projects viewable by anonymous users.
projects = jira_client.projects()
print(projects)

issue = jira_client.issue(issue_key)
print("success")
except Exception as err:
print("Error:", err)

 Here I am getting projectss as empty and unable to get issue instance later.

can anyone help please

regards

Mallika 

1 answer

1 accepted

0 votes
Answer accepted
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 13, 2024

Hi @Mallika Nandikotkur 
Are you trying to get issue details via python ?

You can try below python code - Ensure to replace your-domain.atlassian.net in the url parameter with your cloud site and {issueIdOrKey} with the ID or key of the issue.


import requests
from requests.auth import HTTPBasicAuth
import json

url = "https://your-domain.atlassian.net/rest/api/2/issue/{issueIdOrKey}"

auth = HTTPBasicAuth("email@example.com", "<api_token>")

headers = {
"Accept": "application/json"
}

response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)

print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))

 

Mallika Nandikotkur March 14, 2024

Hi Kishan Sharma,

Thank you so much for quick response. THis works.

regards

Mallika

Like Kishan Sharma likes this
Kishan Sharma
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 14, 2024

Glad to help, Mallika :)

Suggest an answer

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

Atlassian Community Events