I'm having issues iterating through the Jira API. My goal is to iterate until I extract the
response['total']which is 7,000 records. My maxResults is 1,000 per request.
I'm getting a successful response (status code= 200) and my correct 1,000 on maxResults but I'm not updating my startAt, which starts at 0, but I'm expecting to add up to the maxResults. My goal is to iterate through the Jira API to extract all the 7,000 records and append them together as dataframes.
baseUrl= https://example.com/rest/api/2/search?jql=issuetype='Story'
total = 1
maxResults = 0
startAt = 0
while (startAt + maxResults) < total:
data = []
response = requests.get((baseUrl+'&startAt='+str(startAt + maxResults)), auth = (username, password))
print(response.status_code)
r = response.json()
jiraIssues = r["issues"]
for issue in issues:
results_1= json.dumps((issues), sort_keys= True,indent = 4)
results_2 =json.loads(results_1)
results_3 = pd.json_normalize(results_2)
data.append(results_3)
print (len(issues))
print (startAt)
print("----------")
maxResults = response['maxResults']
total = response['total']
startAt = response['startAt']
else:
break
print("none")
