duanji2772 2011-09-14 19:18
浏览 159

Amazon.com MWS通过PHP

Here is what I want to do:

  1. Access my Amazon Marketplace
  2. Generate and save a report as a CSV file. It must include the following information: ORER-ID, PURCHASE DATE, SKU, PRODUCT NAME, SELL PRICE, and SHIPPING INFORMATION

MWS is a mess. If I'm wrong, please let me know!!

I believe that I have to REQUEST the report first and somehow wait until the report is generated.

Once the Report is generated, I should be able to pull the Report ID and get the information from that. Am I right? Is there a sample available showing this process? Any pitfalls I should watch out for?

I am an intermediate PHP Programmer with limited API/Object Oriented programming knowledge. I have been able to successfully program a site to pull orders ONE-BY-ONE but this throttles the system and locks me out of for a time. I need to send ONE REQUEST for the report instead of several requests for individual orders.

  • 写回答

2条回答 默认 最新

  • dtxpz8785 2012-03-22 19:26
    关注

    I don't know about PHP as I use C#, but hopefully these steps will help:

        /*  To generate a report follow the following steps:              
            * 
            *  1. Create a RequestReportRequest object and populate the required information (merchantID, start date, end date etc.) 
            *  2. Request the report by creating a RequestReportResponse object and executing the service RequestReport method using the object name you instantiated in step 1 and set
            *     string requestID = reportResponse.RequestReportResult.ReportRequestInfo.GeneratedReportId to hold the generated report ID. 
            *  3. Create a GetReportRequestListRequest object and populating the required information. 
            *  4. Request the status of the reports by creating a GetReportRequestListResponse object and executing the GetReportRequestList method using the object name you 
            *     instantiated in step 3. 
            *  5. Execute scheduled checks for the status every 60 seconds using a while loop and a System.Threading.Thread.Sleep(60000) call. This is often within the main program. 
            *  6. Create a foreach loop by creating a ReportRequestInfo object and looping over the GetReportRequestListResult.ReportRequestInfo objects within the 
            *     GetReportRequestListResponse object you instantiated in step 4. 
            *  7. Depending upon the status of the report complete any additional processing required. This is often within the main program
            *  8. Once the report returns _DONE_ the report is ready for download. this is often within the main program
            *  9. Request the report by creating a GetReportRequest object and set the report ID to match the GeneratedReportId object of the ReportRequestInfo object that was 
            *     instantiated in step 6. 
            * 10. Set the Report object of the GetReportRequest object instantiated in step 9 to System.IO.File.Open("filename", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite) in 
            *     order to download the report to disk in a streaming fashion. **NOTE** An error of "Uninitilized object reference" will be returned if this is not done! 
            * 11. Request the report by creating a GetReportResponse object and executing the service.GetReport method with the GetReportRequest object instantiated in step 9. 
            * 12. The report has been downloaded and processing can be passed off to other methods. 
            *
            */
    

    It took me a while of trial and error to get this working, The API's are OK once you understand what each class is and more specifically where it needs to be instantiated.

    The report type I think you are looking for is: _GET_AMAZON_FULFILLED_SHIPMENTS_DATA_ as it contains the majority of info.

    I hope these steps help though - it would have saved me a week of debugging had I known them ahead of time :)

    评论

报告相同问题?

悬赏问题

  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法