【发布时间】:2017-02-05 05:40:45
【问题描述】:
在我的网络应用程序中执行 Amazon API 'ItemLookup' 请求并获得响应,例如,我想在 amazon.com 上获取“iPhone 7”的所有 ASIN,我的请求如下所示:
public class Application {
public static void main(String[] args) {
List<String> foundASINs = new ArrayList<>();
Map<String, String> params = new HashMap<>();
params.put("Operation", "ItemSearch");
params.put("ResponseGroup", "ItemIds");
params.put("Keywords", "iphone 7");
params.put("SearchIndex", "Wireless");
AwsRequest request = new AwsRequest();
String res="";
try {
request.getRequest(params);
和 AwsRequest 类:
public Document getRequest (Map<String, String> params) throws IOException, NoSuchAlgorithmException, InvalidKeyException, ParserConfigurationException, SAXException {
params.put("Service", "AWSECommerceService");
params.put("AssociateTag", ASSOCIATE_TAG);
params.put("Version", "2016-09-27");
SignedRequestsHelper helper = SignedRequestsHelper.getInstance(ENDPOINT, AWS_ACCESS_KEY_ID, AWS_SECRET_KEY);
String requestUrl = helper.sign(params);
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse(requestUrl);
return doc;
}
所以我得到了 XML 文档的响应。 一切正常,但我想知道为什么我最多只能获得 10 个 ASIN?如果我检查文档的 TotalResults 属性,必须有 10000+ 个结果,但作为响应,我只能看到 10 个?我怎样才能得到别人?
【问题讨论】:
标签: xml amazon-web-services xml-parsing amazon