|
Project Information
Featured
Downloads
|
Java library that makes it convenient to perform service calls to BandsInTown to retrieve concert events data through the BandsInTown API. Sample: RecommendedRequest bandsService = new RecommendedRequest();
bandsService.setApplicationId("my-application-id");
bandsService.setLocation("San Diego,CA");
bandsService.setRadius(50);
List<String> artistsByName = new ArrayList<String>();
artistsByName.add("Christina Aguilera");
artistsByName.add("Lil' Wayne");
artistsByName.add("britney spears");
bandsService.setArtists(artistsByName);
try {
BandsInTownResponse response = bandsService.callService();
List<Event> events = response.getEvents();
for (Event event : events) {
// process each event
}
} catch (ServiceException e) {
ErrorResponse error = e.getErrorResponse();
if (error != null) {
// error is request constraint failure
int i = 1;
for (String errorMsg : error.getErrors()) {
System.err.println("error " + i + ": " + errorMsg);
i++;
}
} else {
// error is general service failure
System.err.println(e);
}
} catch (Exception e) {
e.printStackTrace();
}
|