public List < ServerGroup > getServerGroups ( ) { ArrayList < ServerGroup > groups = new ArrayList < ServerGroup > ( ) ; try { JSONObject response = new JSONObject ( doGet ( BASE_SERVERGROUP , null ) ) ; JSONArray serverArray = response . getJSONArray ( "servergroups" ) ; for ( int i = 0 ; i < serverArray . length ( ) ; i ++ ) { JSONObject jsonServerGroup = serverArray . getJSONObject ( i ) ; ServerGroup group = getServerGroupFromJSON ( jsonServerGroup ) ; groups . add ( group ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; } return groups ; }
Get the collection of the server groups