src/main/java/se/kth/iv1351/weatherstat/integration/WeatherApiClient.java
/**
   * Returns a list containing the responses from all registered APIs. Only
   * responses with HTTP status codes indicating success (starting with 2 or 3)
   * are included, responses with other status codes are silently ignored.
   * 
   * @return A list with responses from all registered APIs. The list will be
   *         empty if there were no registered APIs, or if there were no
   *         successful responses.
   */
Returns a list containing the responses from all registered APIs. Only
responses with HTTP status codes indicating success (starting with 2 or 3)
are included, responses with other status codes are silently ignored.

@return A list with responses from all registered APIs. The list will be
empty if there were no registered APIs, or if there were no
successful responses.
Returns a list containing the responses from all registered APIs . Only responses with HTTP status codes indicating success ( starting with 2 or 3 ) are included responses with other status codes are silently ignored . @return A list with responses from all registered APIs . The list will be empty if there were no registered APIs or if there were no successful responses .
public List<String> loadFromAllApis() {
    List<String> responses = new ArrayList<>();
    OkHttpClient client = new OkHttpClient();
    for (String weatherService : weatherServices) {
      Request request = new Request.Builder().url(weatherService).build();
      try (Response response = client.newCall(request).execute()) {
        if (response.isSuccessful()) {
          responses.add(response.body().string());
        }
      } catch (IOException ioe) {
        LOGGER.error("Could not load observation.", ioe);
      }
    }
    return responses;
  }
public List < String > loadFromAllApis ( ) { List < String > responses = new ArrayList < > ( ) ; OkHttpClient client = new OkHttpClient ( ) ; for ( String weatherService : weatherServices ) { Request request = new Request . Builder ( ) . url ( weatherService ) . build ( ) ; try ( Response response = client . newCall ( request ) . execute ( ) ) { if ( response . isSuccessful ( ) ) { responses . add ( response . body ( ) . string ( ) ) ; } } catch ( IOException ioe ) { LOGGER . error ( "Could not load observation." , ioe ) ; } } return responses ; }
Returns a list containing the responses from all registered APIs.
Returns a list containing the responses from all registered APIs .