eBayAPI之GetItemTransactions经验

eBayAPI之GetItemTransactions心得

用ebayAPI的GetItemTransactions接口有很长一段时间。
由于我们项目的特殊原因,需求对paypal的transactionID做第二次验证,这时候就要用到GetItemTransactions

获取Item的TransactionArray,然后对比ExternalTransactionID(就是paypal的transactionID)。
在用这个接口的时候,之前一直用ModTimeFromModTimeTo这个两个时间参数来定义时间段,但是使用一段时候后发现总会漏掉一些ItemTransaction,最后发现是ModTimeFromModTimeTo这个参数的问题,官方解释这两个参数,有一段话是这样的:
The ModTimeFrom field is the starting date range. All eBay order line items that were last modified within this date range are returned in the output

也就是说定义这个时间段后,取出来的ItemTransaction是以最后被修改的时间为基准。
这会出现什么问题了?

比如,一个Item的transaction是一号创建的,但是在三天后这个transaction的order被修改过,在ModTimeFrom和ModTimeTo这两个参数取一号的ItemTransaction,这时候是取不到。
在GetItemTransactions方法中还有一个参数:NumberOfDays ,官方解释这个参数,有一段话是这样的:

All eBay order line items that were either created or modified within this period are returned in the response。

就是说,用这个参数可以针对createdDate和LastTimeModified两个属性。不用ModTimeFromModTimeTo  ,而用NumberOfDays 取一个是时间段的数据, 就不会出现漏掉ItemTransaction的情况了。

 GetItemTransactions of official document: 

 http://developer.ebay.com/DevZone/XML/docs/Reference/eBay/GetItemTransactions.html

1 楼 zwlfyl 2013-04-25  
kewinj, please follow up more and more ebay API, thanks