亚马逊产品广告api-项目查找请求工作示例
|
有人会举一个亚马逊
ITEMLOOKUP
的工作示例吗?
我有以下代码,但它似乎不起作用:
string ISBN = \"0393326381\";
string ASIN = \"\";
if (!(string.IsNullOrEmpty(ISBN) && string.IsNullOrEmpty(ASIN)))
{
AWSECommerceServicePortTypeChannel service = new AWSECommerceServicePortTypeChannel();
ItemLookup lookup = new ItemLookup();
ItemLookupRequest request = new ItemLookupRequest();
lookup.AssociateTag = secretKey;
lookup.AWSAccessKeyId = accessKeyId;
if (string.IsNullOrEmpty(ASIN))
{
request.IdType = ItemLookupRequestIdType.ISBN;
request.ItemId = new string[] { ISBN.Replace(\"-\", \"\") };
}
else
{
request.IdType = ItemLookupRequestIdType.ASIN;
request.ItemId = new string[] { ASIN };
}
request.ResponseGroup = new string[] { \"OfferSummary\" };
lookup.Request = new ItemLookupRequest[] { request };
response = service.ItemLookup(lookup);
if (response.Items.Length > 0 && response.Items[0].Item.Length > 0)
{
Item item = response.Items[0].Item[0];
if (item.MediumImage == null)
{
//bookImageHyperlink.Visible = false;
}
else
{
//bookImageHyperlink.ImageUrl = item.MediumImage.URL;
}
//bookImageHyperlink.NavigateUrl = item.DetailPageURL;
//bookTitleHyperlink.Text = item.ItemAttributes.Title;
//bookTitleHyperlink.NavigateUrl = item.DetailPageURL;
if (item.OfferSummary.LowestNewPrice == null)
{
if (item.OfferSummary.LowestUsedPrice == null)
{
//priceHyperlink.Visible = false;
}
else
{
//priceHyperlink.Text = string.Format(\"Buy used {0}\", item.OfferSummary.LowestUsedPrice.FormattedPrice);
//priceHyperlink.NavigateUrl = item.DetailPageURL;
}
}
else
{
//priceHyperlink.Text = string.Format(\"Buy new {0}\", item.OfferSummary.LowestNewPrice.FormattedPrice);
//priceHyperlink.NavigateUrl = item.DetailPageURL;
}
if (item.ItemAttributes.Author != null)
{
//authorLabel.Text = string.Format(\"By {0}\", string.Join(\", \", item.ItemAttributes.Author));
}
else
{
//authorLabel.Text = string.Format(\"By {0}\", string.Join(\", \", item.ItemAttributes.Creator.Select(c => c.Value).ToArray()));
}
/*
ItemLink link = item.ItemLinks.Where(i => i.Description.Contains(\"Wishlist\")).FirstOrDefault();
if (link == null)
{
//wishListHyperlink.Visible = false;
}
else
{
//wishListHyperlink.NavigateUrl = link.URL;
}
* */
}
}
}
问题是这样的:
这应该以不同的方式定义,但我不知道AWSECommerceServicePortTypeChannel服务= new AWSECommerceServicePortTypeChannel();
没有找到相关结果
已邀请:
4 个回复
蹦吃舷弦
这是端点(我对此不以为然,我希望我能记得谁应该这样做):
哦。并且您需要MessageInspector才能正常工作。
最后,标题:
是的,当他们开始需要消息签名时,它们使事情变得复杂了。
臂哦
例
陷牡彭拈峰
这是文档的链接:http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/DG/index.html?ItemLookup.html。请注意SearchIndex参数的描述: 约束:如果ItemIdis为ASIN,则无法在以下位置指定搜索索引 请求。非ASIN ItemIds必需。
嗜蒂谷尘旱