[AmazonMWS]「Required parameter ASINList not found」エラーが発生する。

GetLowestOfferListngsForASINSample.php実行時のエラーメッセージ例
(見やすくするために改行を入れてます)

> php GetLowestOfferListngsForASINSample.php
 
PHP Notice:  Undefined offset: 1 in src\MarketplaceWebServiceProducts\Client.php on line 710
 
Notice: Undefined offset: 1 in src\MarketplaceWebServiceProducts\Client.php on line 710
Caught Exception: Required parameter ASINList not found
Response Status Code: 400
Error Code: MissingParameter
Error Type: Unknown
Request ID: xxxx
XML: <?xml version="1.0"?>
<ErrorResponse xmlns="http://mws.amazonservices.com/schema/Products/2011-10-01">
    <Error>
        <Type>Sender</Type>
        <Code>MissingParameter</Code>
        <Message>
            Required parameter ASINList not found
        </Message>
        <Detail/>
    </Error>
    <RequestID>xxx</RequestID>
</ErrorResponse>
ResponseHeaderMetadata: xxx





原因は、パラメータに検索対象となるASINを指定していない為です。


対処法は、GetLowestOfferListngsForASINSample.phpの先頭付近にある以下の記述に…

 $request = new MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINRequest();
 $request->setSellerId(MERCHANT_ID);
 // object or array of parameters
 invokeGetLowestOfferListingsForASIN($service, $request);



setASINList()を追加します。

 $request = new MarketplaceWebServiceProducts_Model_GetLowestOfferListingsForASINRequest();
 $request->setSellerId(MERCHANT_ID);
 // object or array of parameters
 
 $asinList = new MarketplaceWebServiceProducts_Model_ASINListType();     // <======= 追加
 $asinList->setASIN( '43892404' );                                       // <======= 追加
 $request->setASINList( $asinList );                                     // <======= 追加
 
 invokeGetLowestOfferListingsForASIN($service, $request);



複数のASINを渡したい場合は以下のようにarrayで指定します。
APIドキュメントを見ると分かりますが、指定できるのは最大20個です。

$asinList->setASIN( array( '43892404', '475981339X' ) );





各リクエストに対して何のパラメータが指定できるかは、src\MarketplaceWebServiceProducts\ModelフォルダのxxxRequest.phpを参照すると分かります。
grepをかけると一目瞭然ですね。

src\MarketplaceWebServiceProducts\Model>grep "function.*set" GetLowestOfferListingsForASINRequest.php
    public function setSellerId($value)
    public function setMarketplaceId($value)
    public function setASINList($value)
    public function setItemCondition($value)
    public function setExcludeMe($value)





毎回調べるのは面倒なので、全ファイルgrepした結果を置いときます。

src\MarketplaceWebServiceProducts\Model>grep "function.*set" *Request.php
 
GetCompetitivePricingForASINRequest.php:   public function setSellerId($value)
GetCompetitivePricingForASINRequest.php:   public function setMarketplaceId($value)
GetCompetitivePricingForASINRequest.php:   public function setASINList($value)
 
GetCompetitivePricingForSKURequest.php:    public function setSellerId($value)
GetCompetitivePricingForSKURequest.php:    public function setMarketplaceId($value)
GetCompetitivePricingForSKURequest.php:    public function setSellerSKUList($value)
 
GetLowestOfferListingsForASINRequest.php:  public function setSellerId($value)
GetLowestOfferListingsForASINRequest.php:  public function setMarketplaceId($value)
GetLowestOfferListingsForASINRequest.php:  public function setASINList($value)
GetLowestOfferListingsForASINRequest.php:  public function setItemCondition($value)
GetLowestOfferListingsForASINRequest.php:  public function setExcludeMe($value)
 
GetLowestOfferListingsForSKURequest.php:   public function setSellerId($value)
GetLowestOfferListingsForSKURequest.php:   public function setMarketplaceId($value)
GetLowestOfferListingsForSKURequest.php:   public function setSellerSKUList($value)
GetLowestOfferListingsForSKURequest.php:   public function setItemCondition($value)
GetLowestOfferListingsForSKURequest.php:   public function setExcludeMe($value)
 
GetMatchingProductForIdRequest.php:        public function setSellerId($value)
GetMatchingProductForIdRequest.php:        public function setMarketplaceId($value)
GetMatchingProductForIdRequest.php:        public function setIdType($value)
GetMatchingProductForIdRequest.php:        public function setIdList($value)
 
GetMatchingProductRequest.php:             public function setSellerId($value)
GetMatchingProductRequest.php:             public function setMarketplaceId($value)
GetMatchingProductRequest.php:             public function setASINList($value)
 
GetMyPriceForASINRequest.php:              public function setSellerId($value)
GetMyPriceForASINRequest.php:              public function setMarketplaceId($value)
GetMyPriceForASINRequest.php:              public function setASINList($value)
 
GetMyPriceForSKURequest.php:               public function setSellerId($value)
GetMyPriceForSKURequest.php:               public function setMarketplaceId($value)
GetMyPriceForSKURequest.php:               public function setSellerSKUList($value)
 
GetProductCategoriesForASINRequest.php:    public function setSellerId($value)
GetProductCategoriesForASINRequest.php:    public function setMarketplaceId($value)
GetProductCategoriesForASINRequest.php:    public function setASIN($value)
GetProductCategoriesForSKURequest.php:     public function setSellerId($value)
GetProductCategoriesForSKURequest.php:     public function setMarketplaceId($value)
GetProductCategoriesForSKURequest.php:     public function setSellerSKU($value)
 
GetServiceStatusRequest.php:               public function setSellerId($value)
 
ListMatchingProductsRequest.php:           public function setSellerId($value)
ListMatchingProductsRequest.php:           public function setMarketplaceId($value)
ListMatchingProductsRequest.php:           public function setQuery($value)
ListMatchingProductsRequest.php:           public function setQueryContextId($value)


関連記事

コメントを残す

メールアドレスが公開されることはありません。