2017-07-24 105 views
1

我需要在我的应用程序中获取eBay限制使用情况。我想从这个岗位eBay API - check Finding API calls count?ebay API调用“ApplicationAggregate”在此版本中无效或不受支持错误

这里使用的代码是我的代码示例:

function getEbayApiUsage(){ 
    $ebayCredentials = $this->getEbayCredentials(); 
    $token = $ebayCredentials['token']; 
    $XMLData = '<?xml version="1.0" encoding="utf-8"?> 
     <GetApiAccessRulesRequest xmlns="urn:ebay:apis:eBLBaseComponents"> 
      <RequesterCredentials> 
      <eBayAuthToken>'.$token.'</eBayAuthToken> 
      </RequesterCredentials> 
     </GetApiAccessRulesRequest>'; 
     $reults = $this->callEbayAPI($XMLData, "ApplicationAggregate"); 
     return $reults; 
}  
function callEbayAPI($XMLData, $APICallName) { 
    $COMPATIBILITYLEVEL = $this->COMPATIBILITYLEVEL; 
    $DEVNAME = $this->DEVNAME; 
    $APPNAME = $this->APPNAME; 
    $CERTNAME = $this->CERTNAME; 
    $SiteId = $this->SiteId; 
    $eBayAPIURL = $this->eBayAPIURL; 
    $header = array(
     "X-EBAY-API-COMPATIBILITY-LEVEL: $COMPATIBILITYLEVEL", 
     "X-EBAY-API-DEV-NAME: $DEVNAME", 
     "X-EBAY-API-APP-NAME: $APPNAME", 
     "X-EBAY-API-CERT-NAME: $CERTNAME", 
     "X-EBAY-API-SITEID: $SiteId", 
     "X-EBAY-API-CALL-NAME: " . $APICallName 
    );  
    $ch = curl_init(); 
    curl_setopt($ch, CURLOPT_URL, $eBayAPIURL); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); 
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); 
    curl_setopt($ch, CURLOPT_HEADER, 0); 
    curl_setopt($ch, CURLOPT_HTTPHEADER, $header); 
    curl_setopt($ch, CURLOPT_POST, 1); 
    curl_setopt($ch, CURLOPT_POSTFIELDS, $XMLData); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    $results = curl_exec($ch); 
    curl_close($ch);  
    return $results; 
} 

而且我收到此错误:

不支持的API call.The API调用“ApplicationAggregate “无效或 在此版本中不受支持。2ErrorRequestError92318451796

您可以pl轻松帮助我获得API使用限制?

感谢

回答

0

的问题是与线:

$reults = $this->callEbayAPI($XMLData, "ApplicationAggregate"); 

callEbayAPI期待要调用API操作的名称。在这种情况下,您正在调用GetApiAccessRules。正确的代码应该是:

$reults = $this->callEbayAPI($XMLData, "GetApiAccessRules"); 
+0

非常感谢:) –

相关问题