*AWS(Amazon Web サービス)等 [#y3150931]

RIGHT:更新日&lastmod();

AWSをはじめ価格comなどのデータがXMLファイルとして検索して利用できる

**AWS [#f5abeba7]

AWSを利用して、アマゾンのDBからデータを取得してWeb上に表示する

***登録 [#v5a130c3]

https://aws-portal.amazon.com/gp/aws/developer/registration/index.htmlにアクセスしてAccess Key IDを取得する。

***利用方法 [#nded48c8]

"サンプル"

http://ecs.amazonaws.jp/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=(Access Key ID)&Operation=ItemSearch&SearchIndex=Books&Title=Rails&Version=2007-10-29&ItemPage=2

このようにこのサイトにパラメータをつけてアクセスすると該当データがxml形式で取得できる

この場合は本の中で、キーワードが「Rails」が含まれるものを取得

   <?xml version="1.0" ?> 
 - <ItemSearchResponse  
 xmlns="http://webservices.amazon.com/AWSECommerceService/2007-10-29">
 - <OperationRequest>
 - <HTTPHeaders>
   <Header Name="UserAgent" Value="Mozilla/4.0 (compatible; MSIE 7.0; Windows
  NT 6.0; WOW64; SLCC1; .NET CLR 2.0.50727; .NET CLR 3.0.04506; InfoPath.2)" /> 
   </HTTPHeaders>
   <RequestId>bede52de-1466-4dff-afe5-eeb7f14f6d64</RequestId> 
 - <Arguments>
   <Argument Name="Service" Value="AWSECommerceService" /> 
   <Argument Name="ItemPage" Value="2" /> 
   <Argument Name="Title" Value="Rails" /> 
   <Argument Name="Operation" Value="ItemSearch" /> 
   <Argument Name="Version" Value="2007-10-29" /> 
   <Argument Name="SearchIndex" Value="Books" /> 
   <Argument Name="AWSAccessKeyId" Value="1BWVD8AATMN7CXC0WW02" /> 
   </Arguments>
   <RequestProcessingTime>0.1640020000000000</RequestProcessingTime> 
   </OperationRequest>
 - <Items>
 - <Request>
   <IsValid>True</IsValid> 
 - <ItemSearchRequest>
   <Condition>New</Condition> 
   <DeliveryMethod>Ship</DeliveryMethod> 
   <ItemPage>2</ItemPage> 
   <MerchantId>Amazon</MerchantId> 
   <ResponseGroup>Small</ResponseGroup> 
   <ReviewSort>-SubmissionDate</ReviewSort> 
   <SearchIndex>Books</SearchIndex> 
   <Title>Rails</Title> 
   </ItemSearchRequest>
   </Request>
   <TotalResults>139</TotalResults> 
   <TotalPages>14</TotalPages> 
 - <Item>
   <ASIN>4839928266</ASIN> 
   <DetailPageURL>http://www.amazon.co.jp/Ruby-Rails-%E9%80%86%E5%BC%95%E3%81
 %8D%E3%82%AF%E3%82%A4%E3%83%83%E3%82%AF%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3
 %83%B3%E3%82%B9-2-0%E5%AF%BE%E5%BF%9C/dp/4839928266%3FSubscriptionId
 %3D1BWVD8AATMN7CXC0WW02%26tag%3Dws%26linkCode%3Dxm2%26camp%3D2025%26creative
 %3D165953%26creativeASIN%3D4839928266</DetailPageURL> 
 - <ItemAttributes>
   <Author>大場 寧子</Author> 
   <Author>大場 光一郎</Author> 
   <Author>久保 優子</Author> 
   <Creator Role="監修">株式会社 万葉</Creator> 
   <Manufacturer>毎日コミュニケーションズ</Manufacturer> 
   <ProductGroup>Book</ProductGroup> 
   <Title>Ruby on Rails 逆引きクイックリファレンス Rails 2.0対応</Title> 
   </ItemAttributes>
   </Item>
 (略)

''パラメータ例''~
-Operation 商品情報の検索(例 ItemSearch)
-SubscriptionId または AWSAccessKeyIdで同じ内容
-SearchIndex 検索する対象のインデックス (例 Books Electronics Music MusicTracks)
-Title 含まれるキーワード(どのフィールドまでかはまだ不明)
以下は必要なようだ
-Version=2007-10-29
-ContentType=text/html
XSLファイルは
-Style=(URL) で指定

***html形式で表示 [#z7c59b28]
Styleで指定されるXSLファイルで表示書式を指定できる

''サンプル(style.xsl)''

 <?xml version="1.0"?>
 <xsl:stylesheet
   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
   xmlns:aws="http://webservices.amazon.com/AWSECommerceService/2007-10-29"
   version="1.0">
   <xsl:output method="html" encoding="utf-8"/>
 
 <xsl:template match="/">
     <html lang="ja">
 
     <head>
     <title>XSLサンプル</title>
     </head>
 
     <body>
     <h1> サンプル </h1>
 
     <xsl:apply-templates select="aws:ItemSearchResponse/aws:Items" />
 
     </body>
     </html>
 </xsl:template>
 
 <xsl:template match="aws:ItemSearchResponse/aws:Items">
     <table border="1">
     <tr>
     <th>出版社 </th><th>タイトル</th>
     </tr>
 
     <xsl:apply-templates select="aws:Item" />
 
     </table>
     <p>商品総数 : <xsl:value-of select="aws:TotalResults" /></p>
     <p>ページ総数 : <xsl:value-of select="aws:TotalPages" /></p>
 </xsl:template>
 
 <xsl:template match="aws:Item">
     <tr> <td>
     <xsl:value-of select="aws:ItemAttributes/aws:Manufacturer" /></td>
     <td>
     <xsl:value-of select="aws:ItemAttributes/aws:Title" /></td>
     </tr>
 </xsl:template>
 
 </xsl:stylesheet>



トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS