Skip to content

Instantly share code, notes, and snippets.

@jasonwaters
Forked from sfussenegger/Test.java
Created December 1, 2010 22:37
Show Gist options
  • Save jasonwaters/724370 to your computer and use it in GitHub Desktop.
Save jasonwaters/724370 to your computer and use it in GitHub Desktop.
package fm.setlist.client;
import java.net.URL;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import fm.setlist.api.model.Setlist;
public class Test {
public static void main(String[] args) throws Exception {
final String baseURL = "http://api.setlist.fm/rest";
final String setlistId = "7bd2b248";
// START from api doc
java.net.URL url = new URL(baseURL + "/0.1/search/setlists?artistName=guster");
JAXBContext context = JAXBContext.newInstance( Setlist.class );
java.net.URLConnection connection = url.openConnection();
connection.connect();
Unmarshaller unmarshaller = context.createUnmarshaller();
Setlist result = (Setlist) unmarshaller.unmarshal( connection.getInputStream() );
// END from api doc
System.out.println(result.getUrl());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment