簡體   English   中英

通過PHP的Amazon.com MWS

[英]Amazon.com MWS via PHP

這是我想做的:

  1. 訪問我的亞馬遜市場
  2. 生成報告並將其另存為CSV文件。 它必須包含以下信息:ORER-ID,購買日期,SKU,產品名稱,銷售價格和運輸信息

MWS是一團糟。 如果我錯了,請告訴我!

我認為我必須先請求該報告,然后以某種方式等待報告生成。

生成報告后,我應該能夠提取報告ID並從中獲取信息。 我對嗎? 是否有樣本顯示此過程? 我應該注意任何陷阱嗎?

我是一名中級PHP程序員,具有有限的API /面向對象編程知識。 我已經能夠成功地對站點進行編程以一對一地提取訂單,但這會扼殺系統並將我鎖定一段時間。 我需要為報告發送一個請求,而不是單個訂單的多個請求。

我在使用C#時不了解PHP,但是希望這些步驟會有所幫助:

    /*  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. 
        *
        */

我花了一些時間反復嘗試才能使它起作用。一旦了解了每個類的含義,更具體地講需要實例化該類的位置,API就可以了。

我認為您正在尋找的報告類型是:_GET_AMAZON_FULFILLED_SHIPMENTS_DATA_,因為它包含大多數信息。

我希望這些步驟能對您有所幫助-如果我提前知道它們,它將為我節省一個星期的調試:)

通過Temboo SDK RetrieveReport函數,您可以在單個調用中執行下載單個報告(請求,輪詢狀態,檢索完成的報告數據)所涉及的所有步驟。 該SDK可用於多種語言,包括Java,PHP,Python,Ruby,Node.js等,並且可以免費下載。 看一眼:

https://www.temboo.com/library/Library/Amazon/Marketplace/Reports/RetrieveReport/

(完全公開:我為Temboo工作)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM