亚马逊接口测试地址:
https://mws.amazonservices.com/scratchpad/index.html
开始 test
AmazonApplicationTests
package com.example.amazon.amazon;
import com.example.amazon.amazon.untils.AmazonConstant;
import com.example.amazon.amazon.untils.AmazonUntil;
import com.example.amazon.amazon.untils.GetReportListUntil;
import com.example.amazon.amazon.untils.GetReportList;
import net.sf.json.JSONArray;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.math.BigDecimal;
import java.util.HashMap;
@SpringBootApplication
@RunWith(SpringRunner.class)
@SpringBootTest
public class AmazonApplicationTests implements AmazonConstant {
/**
*
*AmazonUntil
*Reports
*/
@Test
public void Reports() {
//***亚马逊提供密钥***
String secretKey = "r1LaemH2Jx2x******************k2";
HashMap<String, String> parameters = new HashMap<>();
//***亚马逊提供访问id***
parameters.put("AWSAccessKeyId", AmazonUntil.urlEncode("AK*******KA"));
//***商家提供授权token***
parameters.put("MWSAuthToken", AmazonUntil.urlEncode("amzn.mws.96**********b6"));
//***商家提供卖家id***
parameters.put("SellerId", AmazonUntil.urlEncode("A1T**************IJGDS"));
//***Request URL: http://docs.developer.amazonservices.com/zh_CN/dev_guide/DG_Endpoints.html***
parameters.put("ReportType", "_GET_FBA_FULFILLMENT_CURRENT_INVENTORY_DATA_");
parameters.put("MarketplaceId.Id.1", "ATVPDKIKX0DER");
try {
String orders = AmazonUntil.doPost( parameters, secretKey);
GetReportList(orders);
} catch (Exception e) {
;
}
//todo 解析orders数组就是每一条订单的数据
}
/**
*
*GetReportListUntil
*GetReportRequestList
*/
public void GetReportList(String ReportRequestId) {
//***亚马逊提供密钥***
String secretKey = "r1LaemH2Jx2xGStbTqadn1mVJwzYFLyBMKZQLKk2";
HashMap<String, String> parameters = new HashMap<>();
//***亚马逊提供访问id***
parameters.put("AWSAccessKeyId", AmazonUntil.urlEncode("AKIAJEBONJNSXN5L5WKA"));
//***商家提供授权token***
parameters.put("MWSAuthToken", AmazonUntil.urlEncode("amzn.mws.96b29db4-0820-7d35-139c-ad9f3ea196b6"));
//***商家提供卖家id***
parameters.put("SellerId", AmazonUntil.urlEncode("A1TUEZAEMIJGDS"));
//***Request URL: http://docs.developer.amazonservices.com/zh_CN/dev_guide/DG_Endpoints.html***
//n为毫秒数
try { Thread.sleep ( 10000 ) ;
} catch (InterruptedException ie){}
parameters.put("ReportRequestIdList.Id.1", ReportRequestId);
String orders = "";
try {
orders = GetReportListUntil.doPost( parameters, secretKey);
System.out.println("?????"+orders);
GetReport(orders);
} catch (Exception e) {
;
}
//todo 解析orders数组就是每一条订单的数据
}
/**
*
*GetReportListUntil
*GetReportList
* public void GetReport(String GetReport) {
*/
// @Test
public void GetReport(String GetReport) {
//***亚马逊提供密钥***
String secretKey = "r1LaemH2Jx2xGStbTqadn1mVJwzYFLyBMKZQLKk2";
HashMap<String, String> parameters = new HashMap<>();
//***亚马逊提供访问id***
parameters.put("AWSAccessKeyId", AmazonUntil.urlEncode("AKIAJEBONJNSXN5L5WKA"));
//***商家提供授权token***
parameters.put("MWSAuthToken", AmazonUntil.urlEncode("amzn.mws.96b29db4-0820-7d35-139c-ad9f3ea196b6"));
//***商家提供卖家id***
parameters.put("SellerId", AmazonUntil.urlEncode("A1TUEZAEMIJGDS"));
//***Request URL: http://docs.developer.amazonservices.com/zh_CN/dev_guide/DG_Endpoints.html***
parameters.put("ReportId", GetReport);
String orders = "";
try {
orders = GetReportList.doPost( parameters, secretKey);
} catch (Exception e) {
;
}
//todo 解析orders数组就是每一条订单的数据
}
}
2、RequestReport 接口调用
package com.example.amazon.amazon.untils;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
/**
* @auther: hujun
* @date: 2019/5/8 14:19
* @email: 461214737@qq.com
* @description: 亚马逊订单api请求工具类
*/
public class AmazonUntil implements AmazonConstant {
private static final Logger logger = LoggerFactory.getLogger(AmazonUntil.class);
/***
* post请求通道
* @param secretKey
* @param parameters
* @return
* @throws Exception
*/
public static String doPost(HashMap<String, String> parameters, String secretKey) throws Exception {
String str = DateTime.now(DateTimeZone.UTC).toString(TIME_FORMAT_STR);
/**++++++++++++++++++++++++++++++获取当天前00:00:00分-23:59:59的信息 查找过去一天的时间段的数据信息++++++++++++++++++++++++++++++*/
// long zero = LocalDateTime.of(LocalDate.now(), LocalTime.of(8,0)).toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
//String after =new DateTime(zero-1000*3600*24, DateTimeZone.UTC).toString(TIME_FORMAT_STR);
//String before =new DateTime(zero, DateTimeZone.UTC).toString(TIME_FORMAT_STR);
/**++++++++++++++++++++++++++++++++++++以上获取过去整点一天的订单数据信息++++++++++++++++++++++++++++++++++++++++++*/
/***post请求地址*/
/****请求的Amazon方法*/
String ACTION = "RequestReport";
parameters.put("Timestamp", urlEncode(str));
parameters.put("Action", AmazonUntil.urlEncode(ACTION));
parameters.put("SignatureMethod", AmazonUntil.urlEncode(ALGORITHM));
parameters.put("Version", AmazonUntil.urlEncode(VERSION));
parameters.put("SignatureVersion", AmazonUntil.urlEncode(SIGNATURE_VERSION));
parameters.put("StartDate", urlEncode("2020-04-02T00:00:00+00:00"));
parameters.put("EndDate", urlEncode("2020-04-03T00:00:00+00:00"));
parameters.put("Action", AmazonUntil.urlEncode(ACTION));
String formattedParameters = calculateStringToSignV2(parameters, url);
String signature = sign(formattedParameters, secretKey);
parameters.put("Signature", urlEncode(signature));
String paramStr = sortParams(new StringBuilder(), parameters);
return doPost(url, paramStr);
}
/**
* signV2签名内容
*
* @param parameters
* @param serviceUrl
* @return
* @throws SignatureException
* @throws URISyntaxException
*/
public static String calculateStringToSignV2(
Map<String, String> parameters, String serviceUrl)
throws URISyntaxException {
URI endpoint = new URI(serviceUrl.toLowerCase());
StringBuilder data = new StringBuilder();
data.append("POST\n");
data.append(endpoint.getHost());
data.append("\n/Reports/2009-01-01");
data.append("\n");
return sortParams(data, parameters);
}
/***
* signV2签名方式
* @param data
* @param secretKey
* @return
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
* @throws IllegalStateException
* @throws UnsupportedEncodingException
*/
public static String sign(String data, String secretKey)
throws NoSuchAlgorithmException, InvalidKeyException,
IllegalStateException, UnsupportedEncodingException {
Mac mac = Mac.getInstance(ALGORITHM);
mac.init(new SecretKeySpec(secretKey.getBytes(CHARACTER_ENCODING),
ALGORITHM));
byte[] signature = mac.doFinal(data.getBytes(CHARACTER_ENCODING));
String signatureBase64 = new String(Base64.encodeBase64(signature),
CHARACTER_ENCODING);
return new String(signatureBase64);
}
/**
* url非法字符转换
*
* @param rawValue
* @return
*/
public static String urlEncode(String rawValue) {
String value = (rawValue == null) ? "" : rawValue;
String encoded = null;
try {
encoded = URLEncoder.encode(value, CHARACTER_ENCODING)
.replace("+", "%20")
.replace("*", "%2A")
.replace("%7E", "~");
} catch (UnsupportedEncodingException e) {
System.err.println("Unknown encoding: " + CHARACTER_ENCODING);
}
return encoded;
}
/***
* post请求
* @param url
* @param params
* @return
* @throws Exception
*/
public static String doPost(String url, String params) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("Accept", "Accept: text/plain, */*");
httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3724.8 Safari/537.36");
httpPost.addHeader("x-amazon-user-agent", "AmazonJavascriptScratchpad/1.0 (Language=Javascript)");
httpPost.addHeader("X-Requested-With", "XMLHttpRequest");
String charSet = "UTF-8";
StringEntity entity = new StringEntity(params, charSet);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
InputStream is = responseEntity.getContent();
return parseXML(is);
} catch (Exception e) {
throw e;
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
throw e;
}
}
try {
httpclient.close();
} catch (IOException e) {
throw e;
}
}
}
/**
* 对传递参数转换
*
* @param data
* @param parameters
* @return
*/
public static String sortParams(StringBuilder data, Map<String, String> parameters) {
Map<String, String> sorted = new TreeMap<String, String>();
sorted.putAll(parameters);
Iterator<Entry<String, String>> pairs =
sorted.entrySet().iterator();
while (pairs.hasNext()) {
Entry<String, String> pair = pairs.next();
if (pair.getValue() != null) {
data.append(pair.getKey() + "=" + pair.getValue());
} else {
data.append(pair.getKey() + "=");
}
if (pairs.hasNext()) {
data.append("&");
}
}
return data.toString();
}
private static String parseXML(InputStream is) {
JSON xml = new XMLSerializer().readFromStream(is);
JSONObject jsonObject = JSONObject.fromObject(xml);
JSONArray orders = new JSONArray();
if (null != jsonObject.get("RequestReportResult")) {
JSONObject listOrdersResult = (JSONObject) jsonObject.get("RequestReportResult");
if (listOrdersResult != null) {
/***获取到所有的订单内容 list*/
JSONObject orderLists =null;
try {
orderLists=(JSONObject) listOrdersResult.get("ReportRequestInfo");
}catch (Exception e){
}
if (orderLists != null) {
if (orderLists.size() == 1) {
orders.add(orderLists.get("ReportRequestId"));
} else {
/***获取一个订单批次的所有订单内容*/
// orders = (JSONArray) orderLists.get("ReportRequestId");
orders.add(orderLists);
}
}
}
}
JSONObject job= orders.getJSONObject(0);
// 4、把里面想要的参数一个个用.属性名的方式获取到
String ReportRequestId= job.getString("ReportRequestId");
return ReportRequestId;
}
}
3、GetReportRequestList接口调用
package com.example.amazon.amazon.untils;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
/**
* @auther: hujun
* @date: 2019/5/8 14:19
* @email: 461214737@qq.com
* @description: 亚马逊订单api请求工具类
*/
public class GetReportListUntil implements AmazonConstant {
private static final Logger logger = LoggerFactory.getLogger(AmazonUntil.class);
private static String toparams ="";
static String ReportRequestId="";
/***
* post请求通道
* @param secretKey
* @param parameters
* @return
* @throws Exception
*/
public static String doPost( HashMap<String, String> parameters, String secretKey) throws Exception {
String str = DateTime.now(DateTimeZone.UTC).toString(TIME_FORMAT_STR);
/****请求的Amazon方法*/
String ACTION = "GetReportRequestList";
parameters.put("Timestamp", AmazonUntil.urlEncode(str));
parameters.put("Action", AmazonUntil.urlEncode(ACTION));
parameters.put("SignatureMethod", AmazonUntil.urlEncode(ALGORITHM));
parameters.put("Version", AmazonUntil.urlEncode(VERSION));
parameters.put("SignatureVersion", AmazonUntil.urlEncode(SIGNATURE_VERSION));
// parameters.put("ReportId", AmazonUntil.urlEncode("ef61c6b2-b103-4275-b625-eeed59746e15"));
String formattedParameters = AmazonUntil.calculateStringToSignV2(parameters, url);
String signature = AmazonUntil.sign(formattedParameters, secretKey);
parameters.put("Signature", AmazonUntil.urlEncode(signature));
String paramStr = AmazonUntil.sortParams(new StringBuilder(), parameters);
return doPost(url, paramStr);
}
/***
* post请求
* @param url
* @param params
* @return
* @throws Exception
*/
public static String doPost(String url, String params) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("Accept", "Accept: text/plain, */*");
httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3724.8 Safari/537.36");
httpPost.addHeader("x-amazon-user-agent", "AmazonJavascriptScratchpad/1.0 (Language=Javascript)");
httpPost.addHeader("X-Requested-With", "XMLHttpRequest");
String charSet = "UTF-8";
System.out.println("params看"+params);
toparams = params;
StringEntity entity = new StringEntity(params, charSet);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
String as="";
response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
InputStream is = responseEntity.getContent();
return parseXML(is);
} catch (Exception e) {
System.out.println(e.getMessage());
throw e;
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
throw e;
}
}
try {
httpclient.close();
} catch (IOException e) {
throw e;
}
}
}
private static String parseXML(InputStream is) throws Exception {
JSON xml = new XMLSerializer().readFromStream(is);
JSONObject jsonObject = JSONObject.fromObject(xml);
JSONArray orders = new JSONArray();
if (null != jsonObject.get("GetReportRequestListResult")) {
JSONObject listOrdersResult = (JSONObject) jsonObject.get("GetReportRequestListResult");
if (listOrdersResult != null) {
/***获取到所有的订单内容 list*/
JSONObject orderLists =null;
try {
orderLists=(JSONObject) listOrdersResult.get("ReportRequestInfo");
}catch (Exception e){
}
if (orderLists != null) {
if (orderLists.size() == 1) {
orders.add(orderLists.get("ReportRequestId"));
} else {
/***获取一个订单批次的所有订单内容*/
// orders = (JSONArray) orderLists.get("ReportRequestId");
orders.add(orderLists);
}
}
}
}
JSONObject job= orders.getJSONObject(0);
// 4、把里面想要的参数一个个用.属性名的方式获取到
if(job.getString("ReportProcessingStatus").equals("_DONE_")) {
System.out.println("ReportProcessingStatus为:"+job.getString("ReportProcessingStatus"));
ReportRequestId= job.getString("GeneratedReportId");
}else {
if(job.getString("ReportProcessingStatus").equals("_IN_PROGRESS_")) {
//n为毫秒数
try { Thread.sleep ( 5000 ) ;
} catch (InterruptedException ie){}
System.out.println("ReportProcessingStatus"+job.getString("ReportProcessingStatus"));
doPost(url,toparams);
}else {
System.err.println("ReportProcessingStatus"+job.getString("ReportProcessingStatus"));
}
}
System.out.println("ReportRequestId\n"+ReportRequestId);
return ReportRequestId;
}
}
4、最后一步 GetReport 接口调用
package com.example.amazon.amazon.untils;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.xml.XMLSerializer;
import org.apache.commons.codec.binary.Base64;
import org.apache.http.HttpEntity;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.security.SignatureException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import java.util.stream.Collectors;
/**
* @auther: hujun
* @date: 2019/5/8 14:19
* @email: 461214737@qq.com
* @description: 亚马逊订单api请求工具类
*/
public class GetReportList implements AmazonConstant {
private static final Logger logger = LoggerFactory.getLogger(AmazonUntil.class);
private static final String params ="";
/***
* post请求通道
* @param secretKey
* @param parameters
* @return
* @throws Exception
*/
public static String doPost( HashMap<String, String> parameters, String secretKey) throws Exception {
String str = DateTime.now(DateTimeZone.UTC).toString(TIME_FORMAT_STR);
/****请求的Amazon方法*/
String ACTION = "GetReport";
parameters.put("Timestamp", AmazonUntil.urlEncode(str));
parameters.put("Action", AmazonUntil.urlEncode(ACTION));
parameters.put("SignatureMethod", AmazonUntil.urlEncode(ALGORITHM));
parameters.put("Version", AmazonUntil.urlEncode(VERSION));
parameters.put("SignatureVersion", AmazonUntil.urlEncode(SIGNATURE_VERSION));
// parameters.put("ReportId", AmazonUntil.urlEncode("ef61c6b2-b103-4275-b625-eeed59746e15"));
String formattedParameters = AmazonUntil.calculateStringToSignV2(parameters, url);
String signature = AmazonUntil.sign(formattedParameters, secretKey);
parameters.put("Signature", AmazonUntil.urlEncode(signature));
String paramStr = AmazonUntil.sortParams(new StringBuilder(), parameters);
return doPost(url, paramStr);
}
/***
* post请求
* @param url
* @param params
* @return
* @throws Exception
*/
public static String doPost(String url, String params) throws Exception {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpPost httpPost = new HttpPost(url);
httpPost.addHeader("Content-Type", "application/x-www-form-urlencoded;charset=utf-8");
httpPost.setHeader("Accept", "Accept: text/plain, */*");
httpPost.addHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3724.8 Safari/537.36");
httpPost.addHeader("x-amazon-user-agent", "AmazonJavascriptScratchpad/1.0 (Language=Javascript)");
httpPost.addHeader("X-Requested-With", "XMLHttpRequest");
String charSet = "UTF-8";
StringEntity entity = new StringEntity(params, charSet);
httpPost.setEntity(entity);
CloseableHttpResponse response = null;
try {
response = httpclient.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
InputStream is = responseEntity.getContent();
return parseXML(is);
} catch (Exception e) {
throw e;
} finally {
if (response != null) {
try {
response.close();
} catch (IOException e) {
throw e;
}
}
try {
httpclient.close();
} catch (IOException e) {
throw e;
}
}
}
private static String parseXML(InputStream is) throws Exception {
System.out.println("正在获取……请稍等");
String result = new BufferedReader(new InputStreamReader(is))
.lines().parallel().collect(Collectors.joining("\n"));
result=result.replace("2020-"," 2020-");
String [] a1=result.split(" ");
JSONObject jsonParam = new JSONObject();
int y=0;
for(int i=0;i<a1.length;i++){
if(y==0) {
y++;
jsonParam.put("snapshot-date",a1[i]);
System.out.println("snapshot-date: "+a1[i]+"\n");
}else if(y==1) {
y++;
jsonParam.put("fnsku",a1[i]);
System.out.println("fnsku: "+a1[i]+"\n");
}else if(y==2) {
y++;
jsonParam.put("sku",a1[i]);
System.out.println("sku: "+a1[i]+"\n");
}else if(y==3) {
y++;
jsonParam.put("product-name",a1[i]);
System.out.println("product-name: "+a1[i]+"\n");
}else if(y==4) {
y++;
jsonParam.put("quantity",a1[i]);
System.out.println("quantity: "+a1[i]+"\n");
}else if(y==5) {
y++;
jsonParam.put("fulfillment-center-id",a1[i]);
System.out.println("fulfillment-center-id: "+a1[i]+"\n");
}else if(y==6) {
y++;
jsonParam.put("snapshot-date",a1[i]);
System.out.println("detailed-disposition: "+a1[i]+"\n");
}else if(y==7) {
y=0;
jsonParam.put("country",a1[i]);
System.out.println("country: "+a1[i]+"\n");
}
}
// System.out.println("result"+result);
return null;
}
}
5、通用字段
package com.example.amazon.amazon.untils;
/**
* @auther: hujun
* @date: 2019/5/8 11:23
* @email: 461214737@qq.com
* @description: 亚马逊请求默认参数
*/
public interface AmazonConstant {
String url = "https://mws.amazonservices.com/Reports/2009-01-01";
/***post请求后缀*/
String SUFFIX_POST_URL = "/Reports/2009-01-01";
/***订单api版本*/
String VERSION = "2009-01-01";
/***签名方式*/
String ALGORITHM = "HmacSHA256";
/****时间转换格式*/
String TIME_FORMAT_STR = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'Z'";
/****编码格式*/
String CHARACTER_ENCODING = "UTF-8";
String SIGNATURE_VERSION ="2";
/***订单中的所有商品均已发货*/
String SHIPPED ="Shipped";
/**
* AWSAccessKeyId=AKIAJEBONJNSXN5L5WKA
* &Action=RequestReport
* &EndDate=2020-04-07T16%3A00%3A00Z
* &MWSAuthToken=amzn.mws.96b29db4-0820-7d35-139c-ad9f3ea196b6
* &MarketplaceIdList.Id.1=ATVPDKIKX0DER
* &Merchant=A1TUEZAEMIJGDS
* &ReportType=_GET_MERCHANT_LISTINGS_ALL_DATA_
* &SignatureMethod=HmacSHA256
* &SignatureVersion=2
* &StartDate=2020-03-31T16%3A00%3A00Z
* &Timestamp=2020-04-09T09%3A21%3A21Z
* &Version=2009-01-01
*
String AWSAccessKeyId="AKIAJEBONJNSXN5L5WKA";
String Action="ListOrders";
String EndDate="2020-04-07T16%3A00%3A00Z";
String MWSAuthToken="amzn.mws.96b29db4-0820-7d35-139c-ad9f3ea196b6";
String MarketplaceIdList="ATVPDKIKX0DER";
String Merchant="A1TUEZAEMIJGDS";
String ReportType="_GET_MERCHANT_LISTINGS_ALL_DATA_";
String SignatureMethod="HmacSHA256";
String SignatureVersion="2";
String StartDate="2020-03-31T16%3A00%3A00Z";
String Timestamp="2020-04-09T09%3A21%3A21Z";
**/
}
项目拉去git地址 (此项目地址提供的是亚马逊订单api接口开发demo)
https://gitee.com/thlink/idie/tree/master