首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Amazon Advertising API:无法定位SignedRequestHelper类

Amazon Advertising API:无法定位SignedRequestHelper类
EN

Stack Overflow用户
提问于 2017-05-17 00:13:25
回答 1查看 509关注 0票数 0

我已经从亚马逊scratchpad获得了代码,并获得了所需的包。SignedRequestHelper类不在程序包中,我无法运行该程序。我正在尝试使用亚马逊的asin号码来获取商品的价格。

代码语言:javascript
复制
package com.amazon.advertising.api.sample;

import java.util.HashMap;
import java.util.Map;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

/*
 * This class shows how to make a simple authenticated call to the
 * Amazon Product Advertising API.
 *
 * See the README.html that came with this sample for instructions on
 * configuring and running the sample.
 */
public class lookup {

    /*
     * Your AWS Access Key ID, as taken from the AWS Your Account page.
     */
    private static final String AWS_ACCESS_KEY_ID = "XXXXXX";

    /*
     * Your AWS Secret Key corresponding to the above ID, as taken from the AWS
     * Your Account page.
     */
    private static final String AWS_SECRET_KEY = "XXXXXXX";

    /*
     * Use the end-point according to the region you are interested in.
     */
    private static final String ENDPOINT = "webservices.amazon.com";


    public static void main(String[] args) {

        /*
         * Set up the signed requests helper.
         */
        SignedRequestsHelper helper;

        try {
        } catch (Exception e) {
            e.printStackTrace();
            return;
        }

        String requestUrl = null;

        Map<String, String> params = new HashMap<String, String>();

        params.put("Service", "AWSECommerceService");
        params.put("Operation", "ItemLookup");
        params.put("AWSAccessKeyId", "XXXXXX");
        params.put("AssociateTag", "XXXXX");
        params.put("ItemId", "B01H57GXUQ");
        params.put("IdType", "ASIN");
        params.put("ResponseGroup", "Images,ItemAttributes,Offers");

        requestUrl = helper.sign(params);

        System.out.println("Signed URL: \"" + requestUrl + "\"");
    }
}

我如何才能获得signedrequestshelper方法,或者我如何才能更改代码?

EN

回答 1

Stack Overflow用户

发布于 2017-05-17 05:30:45

SignedRequestHelper是来自亚马逊网络服务的一个代码示例中的一个类,如下所示:

http://docs.aws.amazon.com/AWSECommerceService/latest/DG/AuthJavaSampleSig2.html

您可以将代码复制/粘贴到项目中,以使其运行和工作。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44006582

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档