繁体   English   中英

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

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

我正在尝试亚马逊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。

不知道c#,但是在PHP中,您必须创建一个“ MarketplaceWebServiceProducts_Model_ASINListType”类的对象,例如

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

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

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