RESTによるAmazon ECS4の呼出し
RESTは通常のHTTPを利用したWebサービスです。ECSバージョン4ではリクエストURLは以下のようになります。改行していますが一行です。
http://webservices.amazon.co.jp/onca/xml?Service=AWSECommerceService &SubscriptionId=XXXXXXXXXXXXXX&AssociateTag=YYYYYYYYYY &Operation=ItemSearch&Version=2005-10-05 &ResponseGroup=Small,ItemAttributes,OfferFull,Images &Keywords=JavaScript&SearchIndex=Books&ItemPage=1 &ContentType=text/xml
URLへの追加パラメータXXXXXXXXXXXXXXはAmazon Webサービスへの登録IDでYYYYYYYYYYはアソシエートIDですので置き換える必要があります。他のパラメータの意味についてはWebサービスをAmazonで知る(ITmediaの記事)等か本家のドキュメントを参照して下さい。
このURLをブラウザのアドレスバーから直接打ち込むと以下のようなXMLが返されます。(右が切れているかも知れませんが)
<?xml version="1.0" encoding="UTF-8"?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent" Value="Mozilla/5.0 (Windows; U; Windows NT 5.1; ja-JP; rv:1.7.10) Gecko/20050717 Firefox/1.0.6">
</Header>
</HTTPHeaders>
<RequestId>0D2G8TDJD1V1MVVWPZWE</RequestId>
<Arguments>
<Argument Name="AssociateTag" Value="YYYYYYYY"></Argument>
<Argument Name="ItemPage" Value="1"></Argument>
<Argument Name="SubscriptionId" Value="XXXXXXXXXXXX">
</Argument>
<Argument Name="Keywords" Value="JavaScript"></Argument>
<Argument Name="ResponseGroup" Value="Small,ItemAttributes,OfferFull,Images"></Argument>
<Argument Name="Operation" Value="ItemSearch"></Argument>
<Argument Name="Service" Value="AWSECommerceService"></Argument>
<Argument Name="ContentType" Value="text/xml"></Argument>
<Argument Name="SearchIndex" Value="Books"></Argument>
<Argument Name="Version" Value="2005-10-05"></Argument>
</Arguments>
<RequestProcessingTime>0.275908946990967</RequestProcessingTime>
</OperationRequest>
<Items>
<Request><IsValid>True</IsValid>
<ItemSearchRequest>
<ItemPage>1</ItemPage>
<Keywords>JavaScript</Keywords>
<ResponseGroup>OfferFull</ResponseGroup>
<ResponseGroup>ItemAttributes</ResponseGroup>
<ResponseGroup>Small</ResponseGroup>
<ResponseGroup>Images</ResponseGroup>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>132</TotalResults>
<TotalPages>14</TotalPages>
<Item>
<ASIN>4873111692</ASIN>
<DetailPageURL>http://www.amazon.co.jp/exec/obidos/redirect?tag=yumemarocom-22%26link_code=xm2%26camp=2025%26creative=165953%26path=http://www.amazon.co.jp/gp/redirect.html%253fASIN=4873111692%2526tag=yumemarocom-22%2526lcode=xm2%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/4873111692%25253FSubscriptionId=16JZFQWZ2ZABPG6J76G2</DetailPageURL>
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCTHUMBZZZ_.jpg</URL>
<Height Units="pixels">60</Height>
<Width Units="pixels">47</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCMZZZZZZZ_.jpg</URL>
<Height Units="pixels">140</Height>
<Width Units="pixels">110</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCLZZZZZZZ_.jpg</URL>
<Height Units="pixels">475</Height>
<Width Units="pixels">373</Width>
</LargeImage>
<ImageSets>
<ImageSet Category="primary">
<SmallImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCTHUMBZZZ_.jpg</URL>
<Height Units="pixels">60</Height>
<Width Units="pixels">47</Width>
</SmallImage>
<MediumImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCMZZZZZZZ_.jpg</URL>
<Height Units="pixels">140</Height>
<Width Units="pixels">110</Width>
</MediumImage>
<LargeImage>
<URL>http://ec1.images-amazon.com/images/P/4873111692.09._SCLZZZZZZZ_.jpg</URL>
<Height Units="pixels">475</Height>
<Width Units="pixels">373</Width>
</LargeImage>
</ImageSet>
</ImageSets>
<ItemAttributes>
<Author>ダニー グッドマン</Author>
<Binding>単行本</Binding>
<Creator Role="著">ダニー グッドマン</Creator>
<Creator Role="原著">Danny Goodman</Creator>
<Creator Role="翻訳">村上 列</Creator>
<ListPrice>
<Amount>4830</Amount>
<CurrencyCode>JPY</CurrencyCode>
<FormattedPrice>¥ 4,830</FormattedPrice>
</ListPrice>
<NumberOfPages>541</NumberOfPages>
<PackageDimensions>
<Length Units="cm">24</Length>
</PackageDimensions>
<ProductGroup>Book</ProductGroup>
<PublicationDate>2004-01</PublicationDate>
<Publisher>オライリージャパン</Publisher>
<Title>JavaScript & DHTMLクックブック―Webエキスパート必携テクニック集</Title>
</ItemAttributes>
<OfferSummary>
<LowestNewPrice>
<Amount>4830</Amount><CurrencyCode>JPY</CurrencyCode>
<FormattedPrice>¥ 4,830</FormattedPrice>
</LowestNewPrice>
<LowestUsedPrice>
<Amount>3700</Amount><CurrencyCode>JPY</CurrencyCode>
<FormattedPrice>¥ 3,700</FormattedPrice>
</LowestUsedPrice>
<TotalNew>1</TotalNew>
<TotalUsed>2</TotalUsed>
<TotalCollectible>0</TotalCollectible>
<TotalRefurbished>0</TotalRefurbished>
</OfferSummary>
<Offers>
<TotalOffers>1</TotalOffers>
<TotalOfferPages>1</TotalOfferPages>
<Offer>
<Merchant>
<MerchantId>AN1VRQENFRJN5</MerchantId>
<Name>Amazon.co.jp</Name>
</Merchant>
<OfferAttributes>
<Condition>New</Condition>
</OfferAttributes>
<OfferListing>
<OfferListingId>Pak2paqY1zhtjaKxR2%2BNGhDu3O1JBZbIrPPgbCE%2FUkcprr3pjVaocvViDSH69PsDA8RQH%2FvEBsw%3D</OfferListingId>
<Price>
<Amount>4830</Amount><CurrencyCode>
JPY</CurrencyCode>
<FormattedPrice>¥ 4,830</FormattedPrice>
</Price>
<Availability>通常24時間以内に発送</Availability>
</OfferListing>
</Offer>
</Offers>
</Item>
・・・アイテムがあと9個並ぶ
</Items>
</ItemSearchResponse>
Amazon Webサービスでは10個単位でアイテムを返すようになっています。