易趣产品API getProductDetails - 产品ID值xxxx对产品ID类型UPC无效

时间:2017-03-29 16:32:28

标签: php xml ebay ebay-api

试图获得eBay Motors Parts& Co.产品的EPID。提交UPC的配件目录。

以下是电话会议的代码:

$appID = 'xxxxxxxxxxxxxxxxx';
$siteID  = 'EBAY-MOTOR';                            // siteID needed in request
$verb    = 'getProductDetails';                  // the call being made:
$version = '1.4.0';                          // eBay API version

///Build the request XML request which is first part of multi-part POST
$xmlReq = '<?xml version="1.0" encoding="utf-8"?>' . "\n";
$xmlReq .= '<' . $verb . 'Request xmlns="http://www.ebay.com/marketplace/marketplacecatalog/v1/services">' . "\n";
$xmlReq .= "<productDetailsRequest>\n";
$xmlReq .= "<dataset>DisplayableProductDetails</dataset>\n";
$xmlReq .= "<productIdentifier><UPC>" . $upc . "</UPC></productIdentifier>\n";
$xmlReq .= "</productDetailsRequest>\n";
$xmlReq .= "</" . $verb . "Request>";

// Create a new eBay session (defined below) 
$session = new eBaySession_Product($appID, $version, $siteID, $verb);

$respXmlStr = $session->sendHttpRequest($xmlReq);   // send multi-part request and get string XML response
print "respXmlStr: $respXmlStr\n";

if(stristr($respXmlStr, 'HTTP 404') || $respXmlStr == '')
    die('<P>Error sending request');

$respXmlObj = new SimpleXMLElement($respXmlStr);     // create SimpleXML object from string for easier parsing

以下是回复:

Outcome: Failure
ePID:
Error Id: 18
Error Domain: Marketplace
Error Severity: Error
Error Category: System
Error Message: Product ID value 841380031426 is not valid for product ID type UPC.
Error Subdomain: MarketplaceCatalog
Version: 1.3.1
Timestamp: 2017-03-29T16:13:43.672Z

此通话适用于不在零件和零件中的产品。配件目录,例如一本哈利波特的书,但我不能让它适用于任何汽车零件UPC代码。我知道841380031426是一个有效的UPC所以我很难过。非常感谢任何帮助。

谢谢,

P.S。已经尝试过Product-findProducts,Shopping-&gt; FindProducts和Finding-&gt; findItemsByProduct调用但没有成功。

1 个答案:

答案 0 :(得分:1)

UPC不是哈利波特的书upcitemdb.com/upc/841380031426

如果841380031426是ProductID使用

$xmlReq .= "<productIdentifier><productid>" . $upc . "</productid></productIdentifier>\n"; 

docu在这里: https://developer.ebay.com/Devzone/product/CallRef/types/ProductIdentifier.html

还有一个错误:

$siteID  = 'EBAY-MOTOR';

哈利波特书不会出现在ebay马达上