因此,我在使用 GetSellerList 操作的 Trading API 中发现了一些异常活动。当我指定任何值时拨打任何电话都会导致我只返回我的 eBay 商品。我正在考虑拉另一个用户的卖家列表,而不是我自己的。我尝试了多个 API 版本,但我的脚本使用的是 871。
<?php
function print_d($array){ echo "<pre>\n"; print_r($array); echo "</pre>\n";}
$mytoken = "*************mytoken ****************";
$devId = "**************devId ***************";
$appId = "*************appId ***************";
$certId = "**************certId **************";
$wsdl_url = 'http://developer.ebay.com/webservices/latest/ebaySvc.wsdl';
$apiCall = "GetSellerList";
$credentials = array('AppId' => $appId, 'DevID' => $devId, 'AuthCert' => $certId);
$client = new SOAPClient($wsdl_url, array('trace' => 1, 'exceptions' => 0, 'location' => "https://api.ebay.com/wsapi?callname=$apiCall&appid=$appId&siteid=0&version=871&Routing=new"));
$eBayAuth = array('eBayAuthToken' => new SoapVar($mytoken, XSD_STRING, NULL, NULL, NULL, 'urn:ebay:apis:eBLBaseComponents'),
'Credentials' => new SoapVar ($credentials, SOAP_ENC_OBJECT, NULL, NULL, NULL, 'urn:ebay:apis:eBLBaseComponents'));
$header_body = new SoapVar($eBayAuth, SOAP_ENC_OBJECT);
$header = array(new SOAPHeader('urn:ebay:apis:eBLBaseComponents', 'RequesterCredentials', $header_body));
//set the API call parameters
$params = array('UserID'=>'**userid**','DetailLevel'=>'ReturnAll','GranularityLevel'=>'Coarse','WarningLevel'=>'High','IncludeWatchCount'=>'true','Pagination'=>array('EntriesPerPage'=>20,'PageNumber'=>1),'Version' => 871, 'StartTimeFrom'=>'2019-07-01T01:01:02.768Z' ,'StartTimeTo'=>'2019-08-22T01:01:02.768Z');
$request = $client->__soapCall($apiCall, array($params), NULL, $header); //make the actual API call
print_d($request);
?>
Ebay API 中的 GetSellerList 只能用于您自己的帐户,如其官方文档中所指定:
使用此调用检索经过身份验证的用户列出的项目,包括项目数据。
https://developer.ebay.com/devzone/xml/docs/reference/ebay/GetSellerList.html