Created
December 1, 2010 12:42
-
-
Save sfussenegger/723423 to your computer and use it in GitHub Desktop.
setlist.fm client API test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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