I need to get ebay api limit usage in my application. I am trying to use the code from this post eBay API - check Finding API calls count?
Here is my code sample:
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;
}
And I am getting this error :
Unsupported API call.The API call "ApplicationAggregate" is invalid or not supported in this release.2ErrorRequestError92318451796
Can you please help me to get the api usage limit?
Thanks
The issue is with the line:
$reults = $this->callEbayAPI($XMLData, "ApplicationAggregate");
callEbayAPI is expecting the name of the API operation that you want to call. In this instance you are calling GetApiAccessRules. The correct code should be:
$reults = $this->callEbayAPI($XMLData, "GetApiAccessRules");