@ Override public List < Team > getTeams ( ) { List < Team > result = new ArrayList <> ( ) ; try { String url = featureSettings . getJiraBaseUrl ( ) + ( featureSettings . getJiraBaseUrl ( ) . endsWith ( "/" ) ? "" : "/" ) + TEMPO_TEAMS_REST_SUFFIX ; ResponseEntity < String > responseEntity = makeRestCall ( url ) ; String responseBody = responseEntity . getBody ( ) ; JSONArray teamsJson = ( JSONArray ) parser . parse ( responseBody ) ; if ( teamsJson != null ) { for ( Object obj : teamsJson ) { JSONObject jo = ( JSONObject ) obj ; String teamId = getString ( jo , "id" ) ; String teamName = getString ( jo , "name" ) ; Team team = new Team ( teamId , teamName ) ; team . setChangeDate ( "" ) ; team . setTeamType ( "" ) ; team . setAssetState ( "Active" ) ; team . setIsDeleted ( "False" ) ; result . add ( team ) ; } } } catch ( ParseException pe ) { LOGGER . error ( "Parser exception when parsing teams" , pe ) ; } catch ( HygieiaException e ) { LOGGER . error ( "Error in calling JIRA API" , e ) ; } return result ; }
Get all the teams using Jira Rest API