Forums

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

Exporting response data from Jira Forms (including fields not linked to Jira fields)

Ian Balas
Contributor
October 27, 2023

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

1 answer

0 votes
Joseph Chung Yin
Community Champion
October 27, 2023

@Ian Balas -

I am not an expert on REST APIs development, I think you should reach out to Atlassian Support (https://support.atlassian.com) and raise a technical support case.  The support team should be able to route your case to their development team to assist further.

Looking at the REST APIs reference link, it seem this experimental API - " Get project form index" - will get you a list of all the Forms associated within a project - https://developer.atlassian.com/cloud/forms/rest/api-group-forms-on-project/#api-project-projectidorkey-form-get  Have you already look into it?

I know that in the Community, there are many technical developers and hope they can provide you with a possible implementation to achieve your ask.

Sorry.

Best, Joseph Chung Yin

Jira/JSM Functional Lead, Global Technology Applications Team

Viasat Inc.

Ian Balas
Contributor
October 30, 2023

No worries. Thanks for the links, though! I'll reroute this question to them.

Suggest an answer

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

Atlassian Community Events