易趣API。过滤“等待邮资”​​或“未发货”的订单,包含送货详情

时间:2013-03-07 03:22:46

标签: ebay

花费了无数的时间来挖掘eBay API文档而无法找到任何内容。

在卖家帐户上,我需要获取状态为“等待邮资”​​或“未发货”的所有订单的清单。因此,我可以获取所有目前“未发货”的订单的XML报告,其中包含有关客户的详细信息(送货地址,使用的邮资方式等)。

GetOrders没有为未发货的订单提供过滤。
GetSellingManagerSoldListings具有此类功能,但不提供有关客户送货详情的任何详细信息。

有没有人有这样的问题?

提前致谢。

6 个答案:

答案 0 :(得分:4)

GetOrders没有为未发货的订单提供过滤器。但是如果您的GetOrders请求有[ShippedTime]对象意味着该订单是为未发货项目发货的,那么您将无法获得[ShippedTime]的对象。在此基础上,您可以查询未发货的订单

答案 1 :(得分:0)

在相当长的一段时间内,我一直在寻找这个问题的解决方案。这是一个非常古老的问题,但我希望它有一个更直接的答案。会救我几个小时。 @Moazam有正确的想法,但真的缺乏特异性,所以这里。以下答案是用python编写的,基于/使用eBay's Api。 (你会认为显着更容易找到/做)

from ebaysdk.trading import Connection as Trading
from ebaysdk.exception import ConnectionError
import bs4 as bs # beautifulsoup import for parsing xml

try:
    api = Trading(config_file="ebay.yaml") #put ur eBay dev API credentials in yaml file
    response = api.execute('GetSellerTransactions', {}) # dictionary response
    dommy = response.content 

except ConnectionError as e: # spit error if can't connect (ie: wrong api credz)
    print(e)
    print(e.response.dict())

soup = bs.BeautifulSoup(dommy, 'lxml') # parse the API response as xml
tArray = soup.transactionarray 

with open('fullSoldLogXML.xml', 'w+') as xml: # Log file, not required.
    xml.write(str(soup)) # write entire ebay response to log file.

with open('singleTransactions.xml', 'w+') as tranXml: # Another log. Personal reference.
    tranXml.write(str(tArray)) # parse all transactions from transactionarray in xml 

for each in tArray: # tArray is every transaction, in transactionarray)
    print each.shippedtime # print shipped time, if None then hasn't been shipped.

应输出如下内容:

<shippedtime>2016-12-18T15:12:22.000Z</shippedtime>
<shippedtime>2016-12-20T00:35:43.000Z</shippedtime>
<shippedtime>2016-12-20T01:50:37.000Z</shippedtime>
None

使用此信息,您可以对每个事务执行try/except循环。 If shippedtime == None,然后您可以剖析订单并获得有用的信息,例如print each.shippingaddress, each.orderlineitemid, each.paidtime等...

答案 2 :(得分:0)

好吧,我通过使用php下载params来获得订单。

$xmlReq = '<?xml version="1.0" encoding="utf-8"?>';
$xmlReq .= '<GetSellingManagerSoldListingsRequest xmlns="urn:ebay:apis:eBLBaseComponents">';
$xmlReq .= '<UserID>'.$YOUR_EBAY_APP_ID.'</UserID>';
$xmlReq .= '<Filter>PaidNotShipped</Filter>';
$xmlReq .= '<Pagination><EntriesPerPage>200</EntriesPerPage><PageNumber>1</PageNumber></Pagination>';
$xmlReq .= '<ErrorLanguage>en_US</ErrorLanguage>';
$xmlReq .= "<Version>$version</Version>";
$xmlReq .= '<WarningLevel>Low</WarningLevel>';
$xmlReq .= "<RequesterCredentials><eBayAuthToken>$YOUR_AUTH_TOKEN</eBayAuthToken></RequesterCredentials>\n";    
$xmlReq .= '</GetSellingManagerSoldListingsRequest>';

我希望你得到过滤器参数“PaidNoTShipped”。 您将在此响应中获得order_line_item_id并使用此功能只需使用此订单行项目ID GetOrderTransactions进行另一次调用,您将获得其余信息。在GetOrderTransactions中使用<DetailLevel>ReturnAll</DetailLevel>来获得扩展结果。 如果您想了解更多关于api电话的信息,请告诉我。

答案 3 :(得分:0)

GetOrders有RequiredSellerAction标记,显示卖家必须执行的下一步操作。

对于未发货的订单,{&#39; MarkAsShipped&#39;

<PaymentHoldDetails>
<ExpectedReleaseDate>2018-04-20T07:00:00.000Z</ExpectedReleaseDate>
<RequiredSellerActionArray>
<RequiredSellerAction>MarkAsShipped</RequiredSellerAction>
</RequiredSellerActionArray>
<NumOfReqSellerActions>1</NumOfReqSellerActions>
<PaymentHoldReason>CasualSeller on https://www.aihello.com </PaymentHoldReason>
</PaymentHoldDetails>

答案 4 :(得分:0)

这是我的“ hacky”方式:

try
{
$ShippedTime = $order->ShippedTime;
if($ShippedTime && isset($ShippedTime))
$ShippedTime = $ShippedTime->format('d-m-Y H:i:s');
else
$ShippedTime = 'awaiting dispatch'; 
}
catch(Exception $e)
{
 $ShippedTime = 'awaiting dispatch'; 
}

答案 5 :(得分:-1)

这段代码对我有用,希望你觉得它很有用

 date_default_timezone_set('Europe/London');
 $page = 0;
 $order_count = 0;
 $shipped_count = 0;
 do
 {
     $page++;


    $feed = <<< EOD
<?xml version="1.0" encoding="utf-8"?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>$auth_token</eBayAuthToken>
</RequesterCredentials>
<OrderRole>Seller</OrderRole>
<OrderStatus>Completed</OrderStatus>
<Pagination>
<EntriesPerPage>100</EntriesPerPage>
<PageNumber>$page</PageNumber>
</Pagination>
<NumberOfDays>7</NumberOfDays>
<ErrorLanguage>en_GB</ErrorLanguage>
<Version>823</Version>
<WarningLevel>High</WarningLevel>
</GetOrdersRequest>?
EOD;

$feed = trim($feed);
     $site_id = 3;//3 For UK
     $call_name = 'GetOrders';
     $headers = array
         (
         'X-EBAY-API-COMPATIBILITY-LEVEL: ' . $compat_level,
         'X-EBAY-API-DEV-NAME: ' . $dev_id,
         'X-EBAY-API-APP-NAME: ' . $app_id,
         'X-EBAY-API-CERT-NAME: ' . $cert_id,
         'X-EBAY-API-CALL-NAME: ' . $call_name,
         'X-EBAY-API-SITEID: ' . $site_id,
     );

     // Send request to eBay and load response in $response
     $connection = curl_init();
     curl_setopt($connection, CURLOPT_URL, $api_endpoint);
     curl_setopt($connection, CURLOPT_SSL_VERIFYPEER, 0);
     curl_setopt($connection, CURLOPT_SSL_VERIFYHOST, 0);
     curl_setopt($connection, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($connection, CURLOPT_POST, 1);
     curl_setopt($connection, CURLOPT_POSTFIELDS, $feed);
     curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
     $response = curl_exec($connection);
     curl_close($connection);

     $order_count += substr_count($response, "<Order>");
     $shipped_count += substr_count($response, "<ShippedTime>");
 }
 while(stristr($response, "<HasMoreOrders>true</HasMoreOrders>") != FALSE OR stristr($response, "<HasMoreOrders>true</HasMoreOrders>") != 0);
 $unshipped_orders = $order_count - $shipped_count;