如何将项目添加到ASINList列表?

时间:2015-10-30 11:57:11

标签: c# amazon-mws

我正在尝试亚马逊MWS样本。如何使用ASIN列表初始化request.ASINList?

我的ASIN是字符串。

// Create a request.
GetLowestOfferListingsForASINRequest request = new GetLowestOfferListingsForASINRequest();
string sellerId = "example";
request.SellerId = sellerId;
string mwsAuthToken = "example";
request.MWSAuthToken = mwsAuthToken;
string marketplaceId = "example";
request.MarketplaceId = marketplaceId;
ASINListType asinList = new ASINListType();
request.ASINList = asinList;
string itemCondition = "example";
request.ItemCondition = itemCondition;
bool excludeMe = true;
request.ExcludeMe = excludeMe;
return this.client.GetLowestOfferListingsForASIN(request);

我似乎无法隐式或显式地将字符串或字符串数​​组强制转换为ASINListType。

2 个答案:

答案 0 :(得分:1)

不知道c#但是在PHP中你必须创建一个类的对象" MarketplaceWebServiceProducts_Model_ASINListType" e.g。

$asin_list = new MarketplaceWebServiceProducts_Model_ASINListType();
$asin_list->setASIN($asin_array);
$request->setASINList($asin_list);

答案 1 :(得分:0)

您需要将request.ASINList分配给ASINListType。因此,实例化该对象,并将ASIN分配给它的ASIN属性。这只是一种方法,但我通常这么快就这样做:

var asinListType = new ASINListType();
asinListType.ASIN = new List<string> { "B00005TQI7", "B00AVO5XRK", etc, etc };
request.ASINList = asinListType;