当我尝试使用方法 getCategories 通过ebay交易API检索所有类别时,我有这样的错误:
FailureApplication名称无效.API应用程序“222277” invalid.127Error222277RequestError895E895_INTL_APICATALOG_17257399_R1
标题userd是:
$headers = array(
'Content-Type:text/xml',
'X-EBAY-API-COMPATIBILITY-LEVEL: 895',
'X-EBAY-API-DEV-NAME: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'X-EBAY-API-APP-NAME: xxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
'X-EBAY-API-CERT-NAME: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
'X-EBAY-API-CALL-NAME: GetCategories',
'X-EBAY-API-SITEID: 0'
);
XML postfileds是
$body = <<<BODY
<?xml version="1.0" encoding="utf-8"?>
<GetCategoriesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
<RequesterCredentials>
<eBayAuthToken>auth token......</eBayAuthToken>
</RequesterCredentials>
<CategorySiteID>0</CategorySiteID>
<DetailLevel>ReturnAll</DetailLevel>
</GetCategoriesRequest>
BODY;
我的卷曲代码是:
$connection = curl_init();
curl_setopt($connection, CURLOPT_URL, $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, $body);
curl_setopt($connection, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($connection);
curl_close($connection);
答案 0 :(得分:2)
答案 1 :(得分:2)
不幸的是,eBay最近停止了他们的API测试工具。但是,有一些第三方可能就足够了。
对于您的问题,我建议使用名为GetCategoryInfo的更简单的Shopping API调用。您不需要POST请求或发送任何HTTP标头,您可以将整个调用构建为1个URL / REST / GET请求。这使调试变得更加容易。
无论哪种方式,我都不认为您可以通过1个请求检索所有易趣类别。相反,计划在每个级别循环遍历类别树,收集子类别名称和ID。