Skip to content

Instantly share code, notes, and snippets.

@3gcodes
Created January 26, 2009 16:50
Show Gist options
  • Save 3gcodes/52864 to your computer and use it in GitHub Desktop.
Save 3gcodes/52864 to your computer and use it in GitHub Desktop.
public class AmazonTest {
public static void main(String[] args) {
String accessKeyId = "zzzzzzzzzzzzzzzzzz";
String associateTag = "zzzzzzzzzzzzzzzzz";
AmazonA2S service = new AmazonA2SClient(accessKeyId, associateTag);
ItemSearchRequest request = new ItemSearchRequest();
request.setSearchIndex("DVD");
request.setKeywords("Batman");
try {
ItemSearchResponse response = service.itemSearch(request);
System.out.println(response.getItems().size());
for (Items items : response.getItems()) {
for (Item item : items.getItem() ) {
if (item.isSetAlternateVersions()) {
AlternateVersions vs = item.getAlternateVersions();
for (AlternateVersion v : vs.getAlternateVersion()) {
System.out.println(v.getTitle());
}
}
if (item.isSetItemAttributes()) {
ItemAttributes attributes = item.getItemAttributes();
if (attributes.isSetTitle()) {
System.out.println(attributes.getTitle());
System.out.println("--------------------");
}
for (String actor : attributes.getActor()) {
System.out.println(actor);
}
System.out.println("------------------");
}
System.out.println(item.getImageSets().size());
for (ImageSets imageSets : item.getImageSets()) {
for (ImageSet is : imageSets.getImageSet()) {
if (is.isSetSmallImage()) {
System.out.println(is.getSmallImage().getURL());
}
}
}
}
}
} catch (AmazonA2SException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment