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 双层网络上信息-疾病传播
  • ¥50 paddlepaddle pinn
  • ¥15 Stata 面板数据模型选择
  • ¥20 idea运行测试代码报错问题
  • ¥15 网络监控:网络故障告警通知
  • ¥15 django项目运行报编码错误
  • ¥15 请问这个是什么意思?
  • ¥15 STM32驱动继电器
  • ¥15 Windows server update services
  • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏