asp.netでISBN番号を使用して書籍を検索するためにamazon APIを使用するにはどうすればよいですか?Asp.netを使用したAmazon Book Search API
5
A
答えて
2
http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl 上記の与えられたURLのためにsvcutil.exeを使用してプロキシを作成してください。これはGetBookByISBNのメソッドです。 AmazonBookはあなたが自分で作成しなければならない私のcutom DTOです。
public static AmazonBook GetBookByISBN(string ISBN)
{
WebConfigHelper wch = new WebConfigHelper("AWSSettings");
AmazonBook book = null;
string AWSAccessKeyId = wch["AccessKey"];
string AssociateTag = wch["AssociateTag"];
string AWSSecKey = wch["SecretKey"];
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
binding.MaxReceivedMessageSize = int.MaxValue;
AWSECommerceServicePortTypeClient client = new AWSECommerceServicePortTypeClient(
binding,
new EndpointAddress("https://webservices.amazon.com/onca/soap?Service=AWSECommerceService"));
// add authentication to the ECS client
client.ChannelFactory.Endpoint.Behaviors.Add(new AmazonSigningEndpointBehavior(AWSAccessKeyId, AWSSecKey));
ItemSearchRequest request = new ItemSearchRequest();
request.SearchIndex = "Books";
request.Power = "ISBN:" + ISBN.Trim();
request.ResponseGroup = new string[] { "Large" };
request.Sort = "salesrank";
ItemSearchRequest[] requests = new ItemSearchRequest[] { request };
ItemSearch itemSearch = new ItemSearch();
itemSearch.AWSAccessKeyId = AWSAccessKeyId;
itemSearch.AssociateTag = AssociateTag;
itemSearch.Request = requests;
try
{
ItemSearchResponse response = client.ItemSearch(itemSearch);
Items info = response.Items[0];
if (info.Item != null)
{
Item[] items = info.Item;
if (items.Length == 1)
{
book = new AmazonBook(items[0]);
}
}
}
catch (Exception ex)
{
throw ex;
}
return book;
}
Reagards、
0
あなたはnugetと、それは簡単にインストールすることができますNager.AmazonProductAdvertisingこのライブラリを使用することができます。ライブラリはまた、あなたが
PM> Install-Package Nager.AmazonProductAdvertising
に、ここで簡単な例をasp.net Website実装例を見つけることができます.NET標準2.0
をサポートしています。
var authentication = new AmazonAuthentication();
authentication.AccessKey = "accesskey";
authentication.SecretKey = "secretkey";
var wrapper = new AmazonWrapper(authentication, AmazonEndpoint.US);
//The Lord of the Rings
var result = wrapper.Lookup("978-0261102385");
関連する問題
- 1. Amazon Book API for PythonまたはRuby?
- 2. Amazon product search API:Not Working
- 3. restまたはsoap apiを使用したAmazon SNSへのアクセス
- 4. Apple Search APIを使用してジャンルで検索しますか?
- 5. Amazon Product Advertising APIを使用した検索インデックスの混同
- 6. node.js authのようなamazonを使用したRESTful API
- 7. forループを使用したsearch()。
- 8. Twitter Search API(2)
- 9. Twitter Search API
- 10. Bing Image Search API
- 11. Yahoo news search API
- 12. freebase search api
- 13. ElasticSearch用のJava APIを使用したページ分割
- 14. Google App Engine Search API
- 15. php curl search API OAuth
- 16. ASP.NET Active Directory Search
- 17. RailsのiTunes Search API
- 18. Excel 2013:テーブル列を使用したSearch() - 関数の使用
- 19. amazon WS-clientをJavaで製品APIを使用してデボループ化
- 20. Criteria APIの代わりにComplexQueryを使用するHibernate-Search
- 21. WCFまたはASP.Net Web APIを使用したRESTful APIのバージョニングの実装
- 22. twitter search api + paging + max_id + next_page
- 23. Google Site Search XML APIページネーション
- 24. asp.net amazon itemsearch
- 25. Twitter Search APIレート制限Zend
- 26. ASP.NET Core APIを使用したビューを返す
- 27. facebook search apiを使用して最新の投稿を取得する
- 28. Twitter Search APIを使用して必要なエントリ数を取得する方法
- 29. Solr Search Susnpot Gemを使用して
- 30. Amazon S3 APIをiPhone用に使用する
これは、WCFサービス参照のですか? SOAP Webサービスにもっと興味があります。 –
タグを関連付けますか?私はアクセスキーを見ることができますが、タグを関連付けますか? –
アソシエイトタグはAmazonを特定のAmazonアカウントからAmazonにリダイレクトするためにAmazonが使用するものです。詳細はhttps://forums.aws.amazon.com/thread.jspa?messageID=149729 –