简体   繁体   English

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

[英]How do I add items to ASINList list?

I am trying out the Amazon MWS samples. 我正在尝试亚马逊MWS示例。 How do I initialise request.ASINList with a list of ASINs? 如何使用ASIN列表初始化request.ASINList?

My ASINs are in strings. 我的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);

I can't seem to implicitly or explicitly cast a list or array of strings to ASINListType. 我似乎无法隐式或显式将字符串列表或字符串数​​组强制转换为ASINListType。

Don't know c# but in PHP you have to create an object of class "MarketplaceWebServiceProducts_Model_ASINListType" eg 不知道c#,但是在PHP中,您必须创建一个“ MarketplaceWebServiceProducts_Model_ASINListType”类的对象,例如

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

Your request.ASINList needs to be assigned to an ASINListType . 您的request.ASINList需要分配给ASINListType So instantiate that object, and assign your ASINs to it's ASIN property. 因此,实例化该对象,并将您的ASIN分配给它的ASIN属性。 This is just one way of doing it, but I typically do it very quickly this way: 这只是做到这一点的一种方法,但我通常以这种方式非常快地做到这一点:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM