简体   繁体   English

亚马逊产品广告 API C#

[英]Amazon Product Advertising API C#

Can somebody tell me C# excample of using Amazon Product Advertising API, for example to lookup item.有人可以告诉我使用亚马逊产品广告 API 的 C# excample,例如查找项目。 All i found is not working now because of changes.由于更改,我发现的所有内容现在都不起作用。

Thanks!谢谢!

edit:编辑:

the most popular error is "Failed serialization of message body: ItemSearchRequest1 cant create temporary class"最常见的错误是“消息正文序列化失败:ItemSearchRequest1 无法创建临时类”

You can use the following nuget package.您可以使用以下nuget包。

PM> Install-Package Nager.AmazonProductAdvertising

Search example搜索示例

var authentication = new AmazonAuthentication();
authentication.AccessKey = "accesskey";
authentication.SecretKey = "secretkey";

var client = new AmazonProductAdvertisingClient(authentication, AmazonEndpoint.DE);
var result = await client.SearchItemsAsync("canon eos");

There's a C# sample here:这里有一个 C# 示例:

http://aws.amazon.com/code/Product-Advertising-API/3941 http://aws.amazon.com/code/Product-Advertising-API/3941

FWIW, the AWS thread I mentioned includes these steps for a workaround: FWIW,我提到的 AWS 线程包括以下解决方法的步骤:

These are the steps as of January 31, 2012 to fix this issue in Visual Studio for .Net clients:以下是截至 2012 年 1 月 31 日在 Visual Studio for .Net 客户端中修复此问题的步骤:

1) Click the "Show all files" button in the Solution Explorer for the project containing the amazon service reference. 1) 在包含亚马逊服务引用的项目的解决方案资源管理器中单击“显示所有文件”按钮。

2) Expand the reference and open the AWSECommerceService.wsdl file in the editor 2) 展开引用并在编辑器中打开 AWSECommerceService.wsdl 文件

3) On line 584 change the "maxOccurs' to "1". 3) 在第 584 行,将“maxOccurs”更改为“1”。

<xs:element minOccurs="0" maxOccurs="1" name="ImageSets">

4) Save the AWSECommerceService.wsdl file 4) 保存 AWSECommerceService.wsdl 文件

5) Right click Reference.svcmap and click "Run custom tool" 5) 右键单击​​ Reference.svcmap 并单击“运行自定义工具”

6) Expand Reference.svcmap and open either Reference.cs or Reference.vb 6) 展开 Reference.svcmap 并打开 Reference.cs 或 Reference.vb

如果您想使用 Html REST 而不是 Soap/Wsdl,我在我的博客上为 2011 API 和 Visual Studio 2012 更新了一个示例: “最新的 CSharp REST 示例”

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

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