记录点滴

记录生活

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  67 随笔 :: 2 文章 :: 233 评论 :: 17万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

文章来源:http://www.samswiches.com/2011/02/how-to-use-amazon-mws-to-download-unshipped-order-reports/
 

After spending many hours trying to understand Amazon’s API for accessing reports, I’ve finally come up with a solution. Below is one way to download an unshipped orders report.

复制代码
 1 String accessKeyId = "YourSecretKey";
 2 String secretAccessKey = "YourSecretAccessKey";
 3 MarketplaceWebServiceConfig config = new MarketplaceWebServiceConfig();
 4 config.ServiceURL = "https://mws.amazonservices.com";
 5 const string applicationName = "ApplicationName";
 6 const string applicationVersion = "0.1a";
 7  
 8       MarketplaceWebServiceClient service =
 9       new MarketplaceWebServiceClient(
10              accessKeyId,
11              secretAccessKey,
12              applicationName,
13              applicationVersion,
14              config);
15  
16 const string merchantId = "YourMerchantID";
17 const string marketplaceId = "YourMarketplaceID";
18  
19 RequestReportRequest reportRequestRequest = new RequestReportRequest();
20 reportRequestRequest.Merchant = merchantId;
21 reportRequestRequest.Marketplace = marketplaceId;
22 reportRequestRequest.ReportType = "_GET_FLAT_FILE_ACTIONABLE_ORDER_DATA_";
23  
24 RequestReportResponse requestResponse = service.RequestReport(reportRequestRequest);
25 Thread.Sleep(15000);     //wait 15 seconds for order to process
26  
27 GetReportListRequest listRequest = new GetReportListRequest();
28 listRequest.Merchant = merchantId;
29 listRequest.Marketplace = marketplaceId;
30 GetReportListResponse listResponse = service.GetReportList(listRequest);
31  
32 GetReportListResult getReportListResult = listResponse.GetReportListResult;
33 List<ReportInfo> reportInfoList = getReportListResult.ReportInfo;
34 ReportInfo myReportInfo = reportInfoList[0];
35  
36 GetReportRequest reportRequest = new GetReportRequest();
37 reportRequest.Merchant = merchantId;
38 reportRequest.Marketplace = marketplaceId;
39  
40 String source = path + "\\XMLReport.xml";
41 reportRequest.ReportId = myReportInfo.ReportId;
42 reportRequest.Report = File.Open(source, FileMode.Create, FileAccess.ReadWrite);
43 service.GetReport(reportRequest);
44  
45 GetReportRequestListRequest reportRequestListRequest = new GetReportRequestListRequest();
46 reportRequestListRequest.Marketplace = marketplaceId;
47 reportRequestListRequest.Merchant = merchantId;
48 List<ReportRequestInfo> myListzz = new List<ReportRequestInfo>();
49  
50 GetReportRequestListResponse reportRequestListResponse = new GetReportRequestListResponse();
51 reportRequestListResponse = service.GetReportRequestList(reportRequestListRequest);
52 GetReportRequestListResult reportRequestListResult = new GetReportRequestListResult();
53 reportRequestListResult = reportRequestListResponse.GetReportRequestListResult;
54 myListzz = reportRequestListResult.ReportRequestInfo;
55  
56 while (myListzz[0].ReportProcessingStatus.ToString() != "_DONE_")
57      {
58            lblStatus.Text = "Waiting for Report";
59            Thread.Sleep(61000);
60            reportRequestListResponse = service.GetReportRequestList(reportRequestListRequest);
61            reportRequestListResult = reportRequestListResponse.GetReportRequestListResult;
62            myListzz = reportRequestListResult.ReportRequestInfo;
复制代码

63       } 

Hopefully this example will help others trying to do something similar. Please let me know if you have any questions and I’ll do my best to help.

 

posted on   啊峰  阅读(1371)  评论(0编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
历史上的今天:
2012-11-29 c# ThreadPool 判断子线程全部执行完毕的四种方法
点击右上角即可分享
微信分享提示