Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Using Forms via API

Lukasz Grobelny
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 14, 2023

So, I've been struggling to get the forms via API using Scriptrunner. In general, Atlassian documentation is omitting one crucial part - formid which needs to be pulled first. 


So, if anyone needs it, here's a code:

- pulls the form ID from an existing issue

- authenticates to

- pulls the form details


import javax.xml.bind.DatatypeConverter

def issueKey = XXX-123
def username = 'NAME'
def password = 'Auth Token'
def authString = "${username}:${password}"
def encodedAuthString = DatatypeConverter.printBase64Binary(authString.getBytes('UTF-8'))

def formId = get("/rest/api/2/issue/${issueKey}/properties/proforma.forms")
.header('Content-Type', 'application/json')

def id = formId.value.forms[0].uuid

def fields = get("${issueKey}/form/${id}")
.header('Content-Type', 'application/json')
.header('Authorization', "Basic ${encodedAuthString}")
.header('X-ExperimentalApi', 'opt-in')


It pulls the first form, but you can iterate, etc. Hope it will make somebody's day easier ;)  

1 comment

Frédéric Dubois
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 23, 2023

thanks  a lot for the sharing :-)

Like Lukasz Grobelny likes this


Log in or Sign up to comment
AUG Leaders

Atlassian Community Events