I am getting this error. Not very good at scripting. Taking assistance from GPT.
I want to fetch all issues from the project for a date range. the ultimate goal is to fetch worklogs by author but even a simple list of issues is returning no results. I confirmed by JQL in jira that there are issues for this query.
🔍 JQL Query: project = CSS AND created >= "2025-09-01" AND created <= "2025-09-10"
📦 Request Payload: {
"jql": "project = CSS AND created >= \"2025-09-01\" AND created <= \"2025-09-10\"",
"fields": [
"summary",
"status",
"created"
],
"pagination": {
"pageSize": 100
},
"reconcileIssues": true
}
📡 Response Status: 400
❌ Request failed: 400 Client Error: Bad Request for url: https://zlservicedesk.atlassian.net/rest/api/3/search/jql
✅ Downloaded 0 issues across 0 page(s).
-------------------------------------------------------------------------------
Script used
import requests
from requests.auth import HTTPBasicAuth
import json
# === Configuration ===
domain = "zlservicedesk.atlassian.net"
email = "myaddress@domain.com"
api_token = "my api key"
project_key = "CSS"
start_date = "2025-09-01"
end_date = "2025-09-10"
# === API Endpoint ===
url = f"https://{domain}/rest/api/3/search/jql"
# === JQL Query ===
jql_query = f'project = {project_key} AND created >= "{start_date}" AND created <= "{end_date}"'
# === Request Setup ===
auth = HTTPBasicAuth(email, api_token)
headers = {
"Accept": "application/json",
"Content-Type": "application/json"
}
# === Initial Payload ===
payload = {
"jql": jql_query,
"fields": ["summary", "status", "created"],
"pagination": {
"pageSize": 100
},
"reconcileIssues": True
}
# === Debug: Show Request Details ===
print("🔍 JQL Query:", jql_query)
print("📦 Request Payload:", json.dumps(payload, indent=2))
# === Fetch Issues ===
issues = []
next_page_token = None
page_count = 0
while True:
if next_page_token:
payload["nextPageToken"] = next_page_token
try:
response = requests.post(url, headers=headers, json=payload, auth=auth)
print(f"\n📡 Response Status: {response.status_code}")
response.raise_for_status()
data = response.json()
# Debug: Show raw response on first page
if page_count == 0:
print("📄 Raw Response (Page 1):", json.dumps(data, indent=2))
issues.extend(data.get("issues", []))
next_page_token = data.get("nextPageToken")
page_count += 1
if not next_page_token:
break
except requests.exceptions.RequestException as e:
print("❌ Request failed:", e)
break
print(f"\n✅ Downloaded {len(issues)} issues across {page_count} page(s).")
Hey @Vamsi Krishna Panthulu
It looks like GPT might be sending you off in the wrong direction. I'm no python expert but it does seem like you've got a couple of query parameters wrong.
Here are the API docs for the endpoint you're accessing: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-jql-get
So, for starters there's no pagination parameter - you should use maxResults instead.
Further, true is not a valid value for reconcileIssues, which accepts an array of Issue Id's
I'd start by correcting those details in your script - you can also check the endpoint is working for your parameters by pasting your URL directly in your browser when logged in - eg
https://zlservicedesk.atlassian.net/rest/api/3/search/jql?jql=project%20%3D%20CSS&maxResults=10&fields=summary,status,created
which will get 10 issues from the project CSS including the summary, status and created
Hope this helps!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.