Ebay GetOrders API返回0个订单

时间:2015-04-02 05:13:56

标签: ebay ebay-api

我的Ebay API通话请求返回0个订单,但我可以在ebay卖家网站上看到订单。这是获取订单请求:



<?xml version="1.0" encoding="utf-8"?>
<GetOrdersRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  <RequesterCredentials>
    <eBayAuthToken>ABC...123</eBayAuthToken>
  </RequesterCredentials>
<CreateTimeFrom>2015-03-20T00:00:00.000Z</CreateTimeFrom>
  <CreateTimeTo>2015-03-30T00:00:00.000Z</CreateTimeTo>
<NumberOfDays>10</NumberOfDays>
 <OrderRole>Seller</OrderRole>
 <OrderStatus>All</OrderStatus>
<Pagination>
    <EntriesPerPage>100</EntriesPerPage>
    <PageNumber>1</PageNumber>
  </Pagination>
</GetOrdersRequest>
&#13;
&#13;
&#13;

以及以下片段是易趣服务器的响应:

&#13;
&#13;
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents">
  <Timestamp>2015-04-02T04:58:21.086Z</Timestamp>
  <Ack>Success</Ack>
  <Version>915</Version>
  <Build>E915_CORE_APIXO_17437454_R1</Build>
  <PaginationResult>
    <TotalNumberOfPages>0</TotalNumberOfPages>
    <TotalNumberOfEntries>0</TotalNumberOfEntries>
  </PaginationResult>
  <HasMoreOrders>false</HasMoreOrders>
  <OrderArray/>
  <OrdersPerPage>100</OrdersPerPage>
  <PageNumber>1</PageNumber>
  <ReturnedOrderCountActual>0</ReturnedOrderCountActual>
</GetOrdersResponse>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

我没有看到任何错误,但将XML Feed中的WarningLevel属性设置为High会很有用。我使用的下面代码对我有用:

$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>907</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: 823',
             '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);