Amazon Product Advertising API C#
Asked Answered
S

3

7

Can somebody tell me C# excample of using Amazon Product Advertising API, for example to lookup item. All i found is not working now because of changes.

The most popular error is "Failed serialization of message body: ItemSearchRequest1 cant create temporary class"

Soloman answered 6/5, 2012 at 17:25 Comment(1)
Since they have the WSDL support, I would think you'd just have to add a reference to the web service in VS and be good to go, at least in terms of getting the call to go out.Interradial
I
4

There's a C# sample here:

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

FWIW, the AWS thread I mentioned includes these steps for a workaround:

These are the steps as of January 31, 2012 to fix this issue in Visual Studio for .Net clients:

1) Click the "Show all files" button in the Solution Explorer for the project containing the amazon service reference.

2) Expand the reference and open the AWSECommerceService.wsdl file in the editor

3) On line 584 change the "maxOccurs' to "1".

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

4) Save the AWSECommerceService.wsdl file

5) Right click Reference.svcmap and click "Run custom tool"

6) Expand Reference.svcmap and open either Reference.cs or Reference.vb

Interradial answered 6/5, 2012 at 20:16 Comment(8)
i tried this but it isnt working i guess it because of new changesSoloman
FWIW, a quick google search seems to show a related thread @ forums.aws.amazon.com/thread.jspa?threadID=72429Interradial
Good to know! If you don't mind, add an entry on that AWS thread mentioning that it's still needed as of May 2012. :)Interradial
Lol, just encountered the exact same bug! July 26th of 2011 first occurrence, now over a year later, still there!Chap
By the way, it seems that my reference.cs is not updated and I still have 400 bad requestsChap
link to download the sample is unfortunately broken :(Octave
This steps works like a charm. But did not understand what is the deal for step 5 and 6?Rotz
@niico probably easiest to just use the nuget package from the other answer https://mcmap.net/q/1428338/-amazon-product-advertising-api-c but optionally there’s the api details at affiliate-program.amazon.com/gp/advertising/api/detail/…Interradial
G
9

You can use the following nuget package.

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");
Guesswarp answered 22/3, 2016 at 8:17 Comment(5)
Thanks, I hope it will not use your associate id and access key :)Hallock
The code is open source you can build your own binary github.com/tinohager/Nager.AmazonProductAdvertisingGuesswarp
Nager.AmazonProductAdvertising -Not able to build. its keep throwing some errors on xml attributes(assembly reference missing eventhough Sytesm.Xml referenced), Any Idea ?Hallock
I think here is the wrong place, if you have a problem create a issueGuesswarp
I meant the source code you referred github.com/tinohager/Nager.AmazonProductAdvertising. Can you able to build the source code in gitgub ?Hallock
I
4

There's a C# sample here:

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

FWIW, the AWS thread I mentioned includes these steps for a workaround:

These are the steps as of January 31, 2012 to fix this issue in Visual Studio for .Net clients:

1) Click the "Show all files" button in the Solution Explorer for the project containing the amazon service reference.

2) Expand the reference and open the AWSECommerceService.wsdl file in the editor

3) On line 584 change the "maxOccurs' to "1".

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

4) Save the AWSECommerceService.wsdl file

5) Right click Reference.svcmap and click "Run custom tool"

6) Expand Reference.svcmap and open either Reference.cs or Reference.vb

Interradial answered 6/5, 2012 at 20:16 Comment(8)
i tried this but it isnt working i guess it because of new changesSoloman
FWIW, a quick google search seems to show a related thread @ forums.aws.amazon.com/thread.jspa?threadID=72429Interradial
Good to know! If you don't mind, add an entry on that AWS thread mentioning that it's still needed as of May 2012. :)Interradial
Lol, just encountered the exact same bug! July 26th of 2011 first occurrence, now over a year later, still there!Chap
By the way, it seems that my reference.cs is not updated and I still have 400 bad requestsChap
link to download the sample is unfortunately broken :(Octave
This steps works like a charm. But did not understand what is the deal for step 5 and 6?Rotz
@niico probably easiest to just use the nuget package from the other answer https://mcmap.net/q/1428338/-amazon-product-advertising-api-c but optionally there’s the api details at affiliate-program.amazon.com/gp/advertising/api/detail/…Interradial
G
2

If you want to use Html REST instead of Soap/Wsdl, I put an example updated for the 2011 API and Visual Studio 2012 on my blog: "Up to date CSharp REST sample"

Grouty answered 29/4, 2013 at 10:15 Comment(6)
The link you provided appears to be broken.Radius
You're right, and I am sorry! The site is now bilingual, english/french, so the URL for his post changed. I edited the URL in the comment above, let me know if there is any problem.Grouty
I just realised the link was broken again, I just updated it.Grouty
Thanks a lot!! You saved my day. Been searching for a while and could not find a working solution. Your solution is very simple and love the light weight REST method.Bobo
@bernardG I could not find a link to the source code. Did you remove it?Cocaine
Link still dead.Sparerib

© 2022 - 2024 — McMap. All rights reserved.