Getting fields in a screen scheme using JIRA Java Rest Client

Hello,

Im curently using JIRA Java Rest CLient and i want to get all fields present in a screen ( linked to a screen scheme for example) . So to be clear, i have a screen named "myScreen" which contains fields and i want to get those fields using JIRA Java Rest Client.

Thanks in advance,

Hamza

2 answers

1 accepted

This widget could not be displayed.

Hello guys. I eventually found out the answer. I'm using , in fact, Jira Java Rest Client and i retrieve now all the fields linked to an issue type using the code below:

GetCreateIssueMetadataOptions  options = new GetCreateIssueMetadataOptionsBuilder()
		.withExpandedIssueTypesFields()
		
		.withProjectKeys("CGIM")
		.build();
         List myList=(List) restClient.getIssueClient().getCreateIssueMetadata(options, pm); // getting the issue creation metadata relatively to the project im searching for
        java.util.Iterator<CimProject> it1=myList.iterator();
        while(it1.hasNext())
        {
        		CimProject c=it1.next();
        		List issueT=(List) c.getIssueTypes(); // getting the list of issue types linked to this project
        		java.util.Iterator<CimIssueType> it2=issueT.iterator();
            	while (it2.hasNext())
            	{
            		CimIssueType issueType=it2.next();
            		System.out.print(issueType.getName());
            		Map<String, CimFieldInfo> fieldList=issueType.getFields(); // getting the list of fields linked to each issue type 
            		for(Entry<String, CimFieldInfo> entry : fieldList.entrySet()) {
            		    String cle = entry.getKey();
            		    CimFieldInfo valeur = entry.getValue();
            		    System.out.println(valeur.getName());
            		}
            	}

        	
        }

Hope i could help someone who's searching for the same thing and thank you all for your help.

This widget could not be displayed.

Hi Hamza,

I guess you can try to use REST API below to get the available fields:

/rest/api/2/screens/{screenId}/availableFields

https://docs.atlassian.com/jira/REST/latest/#id102121

Hope its helps.

Thanks, John

Hi John, thanks for your answer. can you just tell me how to use such querie in a java project for example?

The method is what John suggested. The above post only says how you can use Jersey to access methods from Java. You need to combine both.

No it actually didn't help. currently i can access issues usig jira java rest client. But my purpose is to have the list of the fields present in a screen that i did define. Im still strugling to find a method to do so.

Ok I'll try it and give you a feedback ASAP. Thanks to both of you .

I am looking exactly for such a code. I tried using above snippet but didnt work. any suggestions?

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted 14 hours ago in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

41 views 1 0
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you