試圖通過提交UPC獲得易趣電機零件產品的EPID &附件目錄。eBay產品API getProductDetails - 產品ID值xxxx對產品ID類型無效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,所以我很難過。任何幫助深表感謝。
感謝,
周杰倫
附:已經嘗試過Product-findProducts,Shopping-> FindProducts和Finding-> findItemsByProduct調用,但沒有成功。
如果任何人都可以提供此API調用不是ePID的工作產品標識符,我將不勝感激。 – HostMyBus