亚马逊产品广告API签名?

时间:2017-02-20 19:45:41

标签: amazon-web-services amazon amazon-product-api

您是否知道如何使用Amazon Product Advertising API设置签名?我知道如何创建签名,但我真的不知道如何设置它?

在下面的代码中,我初始化ASWECommerceService并尝试准备我的搜索,但是当我尝试运行它时 - 我只是得到了404 Bad Request。我认为缺少签名,但如何在Java中设置它?

String secretKey = "abcdef";
String awsKey = "ghijklmnopqrst";

AWSECommerceService service = new AWSECommerceService();
service.setHandlerResolver(new AwsHandlerResolver(secretKey)); 
AWSECommerceServicePortType port = service.getAWSECommerceServicePort();
ItemSearchRequest itemRequest = new ItemSearchRequest();

itemRequest.setSearchIndex("All");
itemRequest.setKeywords("Star Wars");
itemRequest.getResponseGroup().add("Large");
itemRequest.getResponseGroup().add("Images");
ItemSearch ItemElement = new ItemSearch();
ItemElement.setAWSAccessKeyId(awsKey);
ItemElement.setAssociateTag("xyz-21");
ItemElement.getRequest().add(itemRequest);


ItemSearchResponse response = port.itemSearch(ItemElement);

感谢您的帮助!

此致 马尔科

0 个答案:

没有答案