[英]Amazon Product advertising c# api
嗨,大家好,我在从Amazon Web API获取产品时遇到了麻烦。
我已经从互联网上使用了此代码,并添加了所有必要的参考。 我尝试添加视图,并选择itemsearchresponce
作为模型类,但是它不显示产品,出现以下错误:
无法生成临时类(结果= 1)。 错误CS0029:无法将类型'AmazonProduct.com.amazon.webservices.ImageSet'隐式转换为'AmazonProduct.com.amazon.webservices.ImageSet []'
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using AmazonProduct.com.amazon.webservices;
namespace Forest.Controllers
{
public class AmazonController : Controller
{
private AmazonProduct.com.amazon.webservices.AWSECommerceService _Products;
public AmazonController()
{
_Products = new AmazonProduct.com.amazon.webservices.AWSECommerceService();
}
[HttpGet]
public ActionResult listProducts()
{
var searchIndex = "Shoes";
var keywords = "jordan";
// Create an ItemSearch wrapper
ItemSearch search = new ItemSearch();
search.AssociateTag = "[Your Associate ID]";
search.AWSAccessKeyId = "MyKey";
// search.Version= "2011-08-01";
// Create a request object
ItemSearchRequest request = new ItemSearchRequest();
// Fill the request object with request parameters
request.ResponseGroup = new string[] { "ItemAttributes" };
// Set SearchIndex and Keywords
request.SearchIndex = searchIndex;
request.Keywords = keywords;
// Set the request on the search wrapper
search.Request = new ItemSearchRequest[] { request };
ItemSearchResponse response = _Products.ItemSearch(search);
return View(response);
}
}
}
转到生成的代理,然后将ImageSet[][]
替换为ImageSet[]
。
如果还没有的话,还可以看看Amazon Product Advertising API C# 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.