System.err.println("Malformed URL: " + baseUrl);
return;
}
// Send our request to the Analytics API and wait for the results to come back
AccountFeed accountFeed;
try {
accountFeed = as.getFeed(queryUrl, AccountFeed.class);
} catch (IOException e) {
System.err.println("Network error trying to retrieve feed: " + e.getMessage());
return;
} catch (ServiceException e) {
System.err.println("Analytics API responded with an error message: " + e.getMessage());
return;
}
//------------------------------------------------------
// Format Feed Related Data
//------------------------------------------------------
// Print top-level information about the feed
System.out.println(
"\nFeed Title = " + accountFeed.getTitle().getPlainText() +
"\nTotal Results = " + accountFeed.getTotalResults() +
"\nStart Index = " + accountFeed.getStartIndex() +
"\nItems Per Page = " + accountFeed.getItemsPerPage() +
"\nFeed Id = " + accountFeed.getId());
// Print the feeds' entry data
for (AccountEntry entry : accountFeed.getEntries()) {
System.out.println(
"\nWeb Property Id = " + entry.getProperty("ga:webPropertyId") +
"\nAccount Name = " + entry.getProperty("ga:accountName") +
"\nAccount Id = " + entry.getProperty("ga:accountId") +
"\nProfile Name = " + entry.getTitle().getPlainText() +