Hi all,
I need to update a script that's meant to pull data from Jira dynamic form responses for all requests in a project and output as xlsx. Following the Forms on Issue & Forms on Project KBs, I can do it for one issue in a project, but I want to be able to do it for all issues in a project if doable. I figured looping through all issue keys in a project would do the trick:
# This code sample uses the 'requests' library:
# http://docs.python-requests.org
import requests
from requests.auth import HTTPBasicAuth
import json
ticketID = 1
url = "https://api.atlassian.com/jira/forms/cloud/<cloudID>/issue/PROJ-" + str(ticketID) + "/form/e71f55a3-d06d-4997-aad7-72b61fd166f4/attachment"
auth = HTTPBasicAuth("username@example.com", "<atlassianAccountAPIKey>")
headers = {
"Accept": "application/json",
"X-ExperimentalApi": "opt-in"
}
# 239 issues in project PROJ
while ticketID < 239:
response = requests.request(
"GET",
url,
headers=headers,
auth=auth
)
ticketID += 1
print(json.dumps(json.loads(response.text), sort_keys=True, indent=4, separators=(",", ": ")))
Currently, running this script throws the following error output:
ibalas@HV-IT-IBalas ~ % /usr/local/bin/python3 /Users/ibalas/.rest-client/responses/raw/BulkExportREQSJiraForms.py
{
"errors": [
{
"code": "FORM_NOT_FOUND",
"context": [
{
"id": "PROJ-1",
"type": "issue"
},
{
"id": "e71f55a3-d06d-4997-aad7-72b61fd166f4",
"type": "form"
}
],
"detail": "The provided form ID was not found.",
"status": 404,
"title": "Form Not Found"
}
]
}
So now, I gotta see if there's a way to look up all the form UUIDs for the forms associated to a JSM project...and I wonder if the formID could instead be an array of the formIds of All REQS forms...then add a condition before the request to check which particular form is associated to the issue (if any), but I'm pretty stuck on how to do this...Is there a way to pull the form UUIDs for all forms in a project (rather than just one form) in the same script as above?
Any help would be greatly appreciated.
-Ian