我注册了 semantics3 API,以便可以使用他们的 UPC/EAN 产品搜索功能,并且我收到了我的 APIkey 和 APIsecret。现在,我想发出一个 propper Get 请求来测试它,然后最终将它合并到我自己的应用程序中。我从他们的 GitHub 页面下载了 semantics3 java 项目。
无论如何,我如何使用自己的 UPC 或 EAN 代码实际进行 UPC/EAN 查询,以便获得我正在搜索的产品的 JSON 响应?
Semantics3Request 的构造函数如下所示:
public Semantics3Request(String apiKey, String apiSecret, String endpoint) {
if (apiKey == null) {
throw new Semantics3Exception(
"API Credentials Missing",
"You did not supply an apiKey. Please sign up at https://semantics3.com/ to obtain your api_key."
);
}
if (apiSecret == null) {
throw new Semantics3Exception(
"API Credentials Missing",
"You did not supply an apiSecret. Please sign up at https://semantics3.com/ to obtain your api_key."
);
}
this.apiKey = apiKey;
this.apiSecret = apiSecret;
this.endpoint = endpoint;
this.consumer = new DefaultOAuthConsumer(apiKey, apiSecret);
consumer.setTokenWithSecret("", "");
}
一件很重要的事情是,我不明白我应该在其中添加什么,String endpoint
以便以后可以调用 Sematics3Request 类中的方法:、add
和返回JSON 响应的方法。runQuery
fetch
get