Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

issue while fetching jira issues using {JIRA_URL}/rest/api/3/search/jql"

npatil
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!
October 22, 2025
Giving 0 issues while running below - 
import requests
import json
from requests.auth import HTTPBasicAuth
JIRA_URL = "https://tracelink.jira.com/" # Replace with your Jira Cloud domain
JIRA_EMAIL = "myEmail@myCompany.com" # Replace with your Jira email
JIRA_API_TOKEN = "XXXXXX" # Replace with your Jira API token

 

JIRA_API3_SEARCH_ENDPOINT = f"{JIRA_URL}/rest/api/3/search/jql"

 

auth = HTTPBasicAuth(JIRA_EMAIL, JIRA_API_TOKEN)

 

HEADERS = {
"Accept": "application/json",
"Content-Type": "application/json"
}

 

def search_jira_issues(jql_query, max_results=50, fields=None):
payload = {
"jql": jql_query,
"maxResults": max_results,
}
if fields:
payload["fields"] = fields

 

try:
response = requests.post(
JIRA_API3_SEARCH_ENDPOINT,
headers=HEADERS,
data=json.dumps(payload),
auth=auth
)
response.raise_for_status() # Raise an exception for bad status codes
print(response.json())
return response.json()
except requests.exceptions.RequestException as e:
print(f"Error searching Jira issues: {e}")
return None
if __name__ == "__main__":
# Example 1: Search for issues in a specific project
jql = "project = 'TL' ORDER BY created DESC"
issues_data = search_jira_issues(jql, max_results=10)

 

if issues_data:
print("Issues found:")
for issue in issues_data.get("issues", []):
print(f"- {issue['key']}: {issue['fields']['summary']}")

 

print("\n" + "="*30 + "\n")

1 answer

0 votes
Mohamed Benziane
Community Champion
October 22, 2025

Hi,

Welcome to the community

Do you have an error message ?

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events