Skip to content

Instantly share code, notes, and snippets.

@sfussenegger
Created December 1, 2010 12:42
Show Gist options
  • Save sfussenegger/723423 to your computer and use it in GitHub Desktop.
Save sfussenegger/723423 to your computer and use it in GitHub Desktop.
setlist.fm client API test
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 + String.format("/0.1/setlist/%s", setlistId));
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