- Home ›
- Amazon Web サービス入門 ›
- 取得する情報の種類(ResponseGroup) ›
- HERE
商品の画像(Images)
検索に該当した商品の画像を表示する為のURLを取得する場合には「Images」を設定します。実際に記述する場合は次のようにします。
ResponseGroup=Images
では実際に試してみます。
http://ecs.amazonaws.jp/onca/xml? Service=AWSECommerceService &AWSAccessKeyId=[AccessKey] &Version=2009-07-01 &Operation=ItemSearch &SearchIndex=Books &Keywords=終の住処 磯崎 憲一郎 &ResponseGroup=Images
※必要に応じてURLエンコードして下さい。
上記のようなリクエストを送信した場合に取得できる情報は次の通りです。
<?xml version="1.0" ?>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2009-07-01">
<OperationRequest>
<HTTPHeaders>
<Header Name="UserAgent" Value="Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; GTB6; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)" />
</HTTPHeaders>
<RequestId>48d1b662-3c99-4b4e-95f2-3020ee6ea2c3</RequestId>
<Arguments>
<Argument Name="Operation" Value="ItemSearch" />
<Argument Name="Service" Value="AWSECommerceService" />
<Argument Name="AWSAccessKeyId" Value="(key)" />
<Argument Name="Timestamp" Value="2009-07-24T13:56:40.000Z" />
<Argument Name="Signature" Value="f8yyQ0cjtnN8kVSpTOKZv+WZZsBgFVZnHdOt8dgbuFk=" />
<Argument Name="ResponseGroup" Value="Images" />
<Argument Name="SearchIndex" Value="Books" />
<Argument Name="Version" Value="2009-07-01" />
<Argument Name="Keywords" Value="終の住処 磯崎 憲一郎" />
</Arguments>
<RequestProcessingTime>0.0975440000000000</RequestProcessingTime>
</OperationRequest>
<Items>
<Request>
<IsValid>True</IsValid>
<ItemSearchRequest>
<Condition>New</Condition>
<DeliveryMethod>Ship</DeliveryMethod>
<Keywords>終の住処 磯崎 憲一郎</Keywords>
<MerchantId>Amazon</MerchantId>
<ResponseGroup>Images</ResponseGroup>
<ReviewSort>-SubmissionDate</ReviewSort>
<SearchIndex>Books</SearchIndex>
</ItemSearchRequest>
</Request>
<TotalResults>1</TotalResults>
<TotalPages>1</TotalPages>
<Item>
<ASIN>410317711X</ASIN>
<SmallImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL75_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">51</Width>
</SmallImage>
<MediumImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL160_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">108</Width>
</MediumImage>
<LargeImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">337</Width>
</LargeImage>
<ImageSets>
<ImageSet Category="primary">
<SwatchImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL30_.jpg</URL>
<Height Units="pixels">30</Height>
<Width Units="pixels">20</Width>
</SwatchImage>
<SmallImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL75_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">51</Width>
</SmallImage>
<ThumbnailImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL75_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">51</Width>
</ThumbnailImage>
<TinyImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL110_.jpg</URL>
<Height Units="pixels">110</Height>
<Width Units="pixels">74</Width>
</TinyImage>
<MediumImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL._SL160_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">108</Width>
</MediumImage>
<LargeImage>
<URL>http://ecx.images-amazon.com/images/I/51%2B53Z66tiL.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">337</Width>
</LargeImage>
</ImageSet>
<ImageSet Category="variant">
<SwatchImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL._SL30_.jpg</URL>
<Height Units="pixels">30</Height>
<Width Units="pixels">20</Width>
</SwatchImage>
<SmallImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL._SL75_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">50</Width>
</SmallImage>
<ThumbnailImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL._SL75_.jpg</URL>
<Height Units="pixels">75</Height>
<Width Units="pixels">50</Width>
</ThumbnailImage>
<TinyImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL._SL110_.jpg</URL>
<Height Units="pixels">110</Height>
<Width Units="pixels">73</Width>
</TinyImage>
<MediumImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL._SL160_.jpg</URL>
<Height Units="pixels">160</Height>
<Width Units="pixels">107</Width>
</MediumImage>
<LargeImage>
<URL>http://ecx.images-amazon.com/images/I/51Pv8R6D3QL.jpg</URL>
<Height Units="pixels">500</Height>
<Width Units="pixels">334</Width>
</LargeImage>
</ImageSet>
</ImageSets>
</Item>
</Items>
</ItemSearchResponse>
取得できる画像のURLは「SmallImage」「MediumImage」「LargeImage」の3つに加えて、「ImageSets」要素の中に「ImageSet」要素が含まれ、1つの「ImageSet」要素の中には「SwatchImage」「SmallImage」「ThumbnailImage」「TinyImage」「MediumImage」「LargeImage」の6つの画像を表す要素が含まれています。
また「ImageSets」要素には複数の「ImageSet」要素が含まれる場合があります。「ImageSet」要素には「Category」属性があり上記のように「primary」の他に「variant」が設定された「ImageSet」要素も含まれている時があります。
( Written by Tatsuo Ikura )
AjaxTower