Forums

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

How to list all projects in Script Runner?

Mitchell Lau
October 29, 2019

Objective: Release a projects' version using Jira Cloud Script Runner (groovy). Ideally, when a ticket is transitioned to a certain workflow status, the script runner will release the version associated with the ticket. 

Problem: How do I list all the software projects? 

I've searched the documentation looking for a way to get all projects + the versions that are included  in the project to no avail. It seems unirest isn't able to import projects like it would import a trigger issue.

I have considered calling: 

HttpResponse<JsonNode> response = Unirest.get("/rest/api/2/project/{projectkey}/versions")
.basicAuth("example@example.com", "<api_token>")
.header("Accept", "application/json")
.asJson();

 and adding a static project key to find my versions.

Any other, more efficient ideas?

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
PD Sheehan
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 Champions.
April 26, 2019

I generally ignore static type checking errors. These can help with debugging your code, but they don't automatically mean that your code is bad.

I would run it and look at the specific line that's failing by reviewing the logs.

TAGS
AUG Leaders

Atlassian Community Events