ebay API调用“ApplicationAggregate”无效或在此版本中不受支持错误

时间:2017-07-24 12:49:29

标签: php ebay-api

我需要在我的应用程序中使用ebay api限制。我正在尝试使用此帖eBay API - check Finding API calls count?

中的代码

这是我的代码示例:

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调用.API调用“ApplicationAggregate”无效或   此版本不受支持.2ErrorRequestError92318451796

你能帮助我获得api使用限制吗?

由于

1 个答案:

答案 0 :(得分:0)

问题在于:

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

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

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