api中文文档 mws,使用产品API从亚马逊MWS获取产品

I have successfully posted product in amazon using amazon MWS Feeds API. Now i want to list those products using the Products API, But im facing some errors.

I run GetMatchingProductSample.php.

Caught Exception: Required parameter ASINList not found Response Status Code: 400 Error Code: MissingParameter Error Type: Sender Request ID: 8bb9c8d1-f48c-495c-be86-89492976b4a9 XML: SenderMissingParameterRequired parameter ASINList not found8bb9c8d1-f48c-495c-be86-89492976b4a9 ResponseHeaderMetadata: RequestId: 8bb9c8d1-f48c-495c-be86-89492976b4a9

Code:

require_once('.config.inc.php');

$serviceUrl = "https://mws-eu.amazonservices.com/Products/2011-10-01";

$config = array (

'ServiceURL' => $serviceUrl,

'ProxyHost' => null,

'ProxyPort' => -1,

'ProxyUsername' => null,

'ProxyPassword' => null,

'MaxErrorRetry' => 3,

);

$service = new MarketplaceWebServiceProducts_Client(

AWS_ACCESS_KEY_ID,

AWS_SECRET_ACCESS_KEY,

APPLICATION_NAME,

APPLICATION_VERSION,

$config);

$request = new MarketplaceWebServiceProducts_Model_GetMatchingProductRequest();

$request->setSellerId(MERCHANT_ID);

// object or array of parameters

invokeGetMatchingProduct($service, $request);

function invokeGetMatchingProduct(MarketplaceWebServiceProducts_Interface $service, $request)

{

try {

$response = $service->GetMatchingProduct($request);

echo ("Service Response\n");

echo ("=============================================================================\n");

$dom = new DOMDocument();

$dom->loadXML($response->toXML());

$dom->preserveWhiteSpace = false;

$dom->formatOutput = true;

echo $dom->saveXML();

echo("ResponseHeaderMetadata: " . $response->getResponseHeaderMetadata() . "\n");

} catch (MarketplaceWebServiceProducts_Exception $ex) {

echo("Caught Exception: " . $ex->getMessage() . "\n");

echo("Response Status Code: " . $ex->getStatusCode() . "\n");

echo("Error Code: " . $ex->getErrorCode() . "\n");

echo("Error Type: " . $ex->getErrorType() . "\n");

echo("Request ID: " . $ex->getRequestId() . "\n");

echo("XML: " . $ex->getXML() . "\n");

echo("ResponseHeaderMetadata: " . $ex->getResponseHeaderMetadata() . "\n");

}

}

解决方案As it says ASINList not found

You need to add these line of code after below line

$request->setSellerId(MERCHANT_ID);

Code needs to add:

$request->setMarketplaceId($marketplace_id);

$asin_list = new MarketplaceWebServiceProducts_Model_ASINListType();

$asins = array("ASIN1","ASIN2","ASIN3");

$asin_list->setASIN($asins);

$request->setASINList($asin_list);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值