How to export jira form response data from all requests in a JSM project

Hi all,
I need help extracting Jira Forms data from all issues in a JSM project & export into a .xlsx file in one go. In reference to the experimental Forms API and with help from Atlassian Support, I got as far as setting up the following:

import requests
from requests.auth import HTTPBasicAuth
from config import jiraPass
import json

ticketID = 300
formURL = ("https://mycompany.atlassian.net/rest/api/2/issue/PROJ-" + str(ticketID) + "/properties/proforma.forms")

auth = HTTPBasicAuth("ibalas@example.com", jiraPass)

formHeaders = {
  "Accept": "application/json",
  "X-ExperimentalApi": "opt-in"
}

formResponse = requests.request(
   "GET",
   formURL,
   headers=formHeaders,
   auth=auth
)

formResponse = (json.dumps(json.loads(formResponse.text), sort_keys=True, indent=4, separators=(",", ": ")))
form = json.loads(formResponse)
forms = (form['value']['forms'])
formUUID = (forms[0]['uuid'])

url = ("https://api.atlassian.com/jira/forms/cloud/6c419365-ed97-4ccd-80aa-5b1599b7cbc1/issue/REQS-" + str(ticketID) + "/form/" + formUUID + "/format/xlsx")

headers = {
  "Accept": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
  "X-ExperimentalApi": "opt-in"
}

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

output = open('forms/PROJ-' + str(ticketID) + '.xlsx', 'wb')
output.write(response.content)
output.close()

I can loop through every issue ID in the PROJ JSM project, and I can get the uuid per issue and convert into an excel spreadsheet, but now I gotta figure out how to get the output for each issue all into 1 spreadsheet…if anyone out there knows what’s missing, any tips/pointers would be much appreciated.

-Ian

Hello @IanBalas2

In simple terms… you can’t. You have to get all the IDs of all the Issues first, then you have to loop through those to get the forms data per issue.

There is no ‘one call’ to do all that, because that’s not how the REST API works.

1 Like