【背景】
折腾:
过程中,想要试试ResponseGroup的Variations。
【折腾过程】
1.有了:
【整理】C#版的AWS的ResponseGroup的VariationSummary示例代码
的经验后,就可以直接去获取产品的Variation的parent的ASIN,然后直接去获得其中的所有的,全部的variations的信息了。
2. 完整代码如下:
(1)ItemLookupSample.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /********************************************************************************************** * Copyright 2009 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file * except in compliance with the License. A copy of the License is located at * * * or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under the License. * * ******************************************************************************************** * * Amazon Product Advertising API * Signed Requests Sample Code * * API Version: 2009-03-31 * */ using System; using System.Collections.Generic; using System.Text; using System.Net; using System.IO; using System.Xml; using System.Xml.XPath; namespace AmazonProductAdvtApi { class ItemLookupSample { private const string awsAccessKeyId = "xxx" ; private const string awsSecretKey = "xxx" ; private const string awsAssociateTag = "xxx" ; private const string awsDestination = "ecs.amazonaws.com" ; private const string awsApiVersion = "2011-08-02" ; //private const string NAMESPACE = "http://webservices.amazon.com/AWSECommerceService/2009-03-31"; //private const string NAMESPACE = "http://webservices.amazon.com/AWSECommerceService/2011-08-01"; private const string NAMESPACE = "http://webservices.amazon.com/AWSECommerceService/" + awsApiVersion; //private const string ITEM_ID = "0545010225"; //private const string ITEM_ID = "B0083PWAPW"; //<Item> // <ASIN>B0083PWAPW</ASIN> // <ParentASIN>B008GGCAVM</ParentASIN> //</Item> private const string ITEM_ID = "B008GGCAVM" ; public static void Main() { SignedRequestHelper helper = new SignedRequestHelper(awsAccessKeyId, awsSecretKey, awsAssociateTag, awsDestination); /* * Here is an ItemLookup example where the request is stored as a dictionary. */ IDictionary< string , string > reqDict = new Dictionary< string , String>(); reqDict[ "Service" ] = "AWSECommerceService" ; //r1["Version"] = "2009-03-31"; //r1["Version"] = "2009-03-31"; reqDict[ "Version" ] = "2011-08-02" ; reqDict[ "Operation" ] = "ItemLookup" ; reqDict[ "IdType" ] = "ASIN" ; reqDict[ "ItemId" ] = ITEM_ID; //reqDict["ResponseGroup"] = "Small"; //reqDict["ResponseGroup"] = "OfferSummary"; //reqDict["ResponseGroup"] = "ItemAttributes"; //reqDict["ResponseGroup"] = "VariationSummary"; reqDict[ "ResponseGroup" ] = "Variations" ; /* * The helper supports two forms of requests - dictionary form and query string form. */ String requestUrl; String title; requestUrl = helper.Sign(reqDict); title = FetchTitle(requestUrl); System.Console.WriteLine( "Method 1: ItemLookup Dictionary form." ); System.Console.WriteLine( "Title is \"" + title + "\"" ); System.Console.WriteLine(); } private static string FetchTitle( string url) { try { WebRequest request = HttpWebRequest.Create(url); WebResponse response = request.GetResponse(); XmlDocument doc = new XmlDocument(); doc.Load(response.GetResponseStream()); //for debug System.Console.WriteLine(doc.InnerXml); XmlNodeList errorMessageNodes = doc.GetElementsByTagName( "Message" , NAMESPACE); if (errorMessageNodes != null && errorMessageNodes.Count > 0) { String message = errorMessageNodes.Item(0).InnerText; return "Error: " + message + " (but signature worked)" ; } XmlNode titleNode = doc.GetElementsByTagName( "Title" , NAMESPACE).Item(0); string title = titleNode.InnerText; response.Close(); return title; } catch (Exception e) { System.Console.WriteLine( "Caught Exception: " + e.Message); System.Console.WriteLine( "Stack Trace: " + e.StackTrace); } finally { } return null ; } } } |
(2)SignedRequestHelper.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 | /********************************************************************************************** * Copyright 2009 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file * except in compliance with the License. A copy of the License is located at * * * or in the "LICENSE.txt" file accompanying this file. This file is distributed on an "AS IS" * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under the License. * * ******************************************************************************************** * * Amazon Product Advertising API * Signed Requests Sample Code * * API Version: 2009-03-31 * */ using System; using System.Collections.Generic; using System.Text; using System.Web; using System.Security.Cryptography; namespace AmazonProductAdvtApi { class SignedRequestHelper { private string endPoint; private string akid; //added by Crifan Li //Product Advertising API Change Details //Associate Tag Parameter: Every request made to the API should include a valid Associate Tag. Any request that does not contain a valid Associate Tag will be rejected with an appropriate error message. For details on the Associate Tag parameter, please refer to our Developer guide. //-> must add this Associate Tag, otherwise will return: //<Error> // <Code>AWS.MissingParameters</Code> // <Message>Your request is missing required parameters. Required parameters include AssociateTag.</Message> //</Error> private string associateTag; private byte [] secret; private HMAC signer; private const string REQUEST_URI = "/onca/xml" ; private const string REQUEST_METHOD = "GET" ; /* * Use this constructor to create the object. The AWS credentials are available on * * The destination is the service end-point for your application: * US: ecs.amazonaws.com * JP: ecs.amazonaws.jp * UK: ecs.amazonaws.co.uk * DE: ecs.amazonaws.de * FR: ecs.amazonaws.fr * CA: ecs.amazonaws.ca */ public SignedRequestHelper( string awsAccessKeyId, string awsSecretKey, string awsAssociateTag, string destination) { this .endPoint = destination.ToLower(); this .akid = awsAccessKeyId; //added by Crifan Li this .associateTag = awsAssociateTag; this .secret = Encoding.UTF8.GetBytes(awsSecretKey); this .signer = new HMACSHA256( this .secret); } /* * Sign a request in the form of a Dictionary of name-value pairs. * * This method returns a complete URL to use. Modifying the returned URL * in any way invalidates the signature and Amazon will reject the requests. */ public string Sign(IDictionary< string , string > request) { // Use a SortedDictionary to get the parameters in naturual byte order, as // required by AWS. ParamComparer pc = new ParamComparer(); SortedDictionary< string , string > sortedMap = new SortedDictionary< string , string >(request, pc); // Add the AWSAccessKeyId and Timestamp to the requests. sortedMap[ "AWSAccessKeyId" ] = this .akid; //added by Crifan Li sortedMap[ "AssociateTag" ] = this .associateTag; sortedMap[ "Timestamp" ] = this .GetTimestamp(); // Get the canonical query string string canonicalQS = this .ConstructCanonicalQueryString(sortedMap); // Derive the bytes needs to be signed. StringBuilder builder = new StringBuilder(); builder.Append(REQUEST_METHOD) .Append( "\n" ) .Append( this .endPoint) .Append( "\n" ) .Append(REQUEST_URI) .Append( "\n" ) .Append(canonicalQS); string stringToSign = builder.ToString(); byte [] toSign = Encoding.UTF8.GetBytes(stringToSign); // Compute the signature and convert to Base64. byte [] sigBytes = signer.ComputeHash(toSign); string signature = Convert.ToBase64String(sigBytes); // now construct the complete URL and return to caller. StringBuilder qsBuilder = new StringBuilder(); .Append( this .endPoint) .Append(REQUEST_URI) .Append( "?" ) .Append(canonicalQS) .Append( "&Signature=" ) .Append( this .PercentEncodeRfc3986(signature)); return qsBuilder.ToString(); } /* * Sign a request in the form of a query string. * * This method returns a complete URL to use. Modifying the returned URL * in any way invalidates the signature and Amazon will reject the requests. */ public string Sign( string queryString) { IDictionary< string , string > request = this .CreateDictionary(queryString); return this .Sign(request); } /* * Current time in IS0 8601 format as required by Amazon */ private string GetTimestamp() { DateTime currentTime = DateTime.UtcNow; string timestamp = currentTime.ToString( "yyyy-MM-ddTHH:mm:ssZ" ); return timestamp; } /* * Percent-encode (URL Encode) according to RFC 3986 as required by Amazon. * * This is necessary because .NET's HttpUtility.UrlEncode does not encode * according to the above standard. Also, .NET returns lower-case encoding * by default and Amazon requires upper-case encoding. */ private string PercentEncodeRfc3986( string str) { str = HttpUtility.UrlEncode(str, System.Text.Encoding.UTF8); str = str.Replace( "'" , "%27" ).Replace( "(" , "%28" ).Replace( ")" , "%29" ).Replace( "*" , "%2A" ).Replace( "!" , "%21" ).Replace( "%7e" , "~" ).Replace( "+" , "%20" ); StringBuilder sbuilder = new StringBuilder(str); for ( int i = 0; i < sbuilder.Length; i++) { if (sbuilder[i] == '%' ) { if (Char.IsLetter(sbuilder[i + 1]) || Char.IsLetter(sbuilder[i + 2])) { sbuilder[i + 1] = Char.ToUpper(sbuilder[i + 1]); sbuilder[i + 2] = Char.ToUpper(sbuilder[i + 2]); } } } return sbuilder.ToString(); } /* * Convert a query string to corresponding dictionary of name-value pairs. */ private IDictionary< string , string > CreateDictionary( string queryString) { Dictionary< string , string > map = new Dictionary< string , string >(); string [] requestParams = queryString.Split( '&' ); for ( int i = 0; i < requestParams.Length; i++) { if (requestParams[i].Length < 1) { continue ; } char [] sep = { '=' }; string [] param = requestParams[i].Split(sep, 2); for ( int j = 0; j < param.Length; j++) { param[j] = HttpUtility.UrlDecode(param[j], System.Text.Encoding.UTF8); } switch (param.Length) { case 1: { if (requestParams[i].Length >= 1) { if (requestParams[i].ToCharArray()[0] == '=' ) { map[ "" ] = param[0]; } else { map[param[0]] = "" ; } } break ; } case 2: { if (! string .IsNullOrEmpty(param[0])) { map[param[0]] = param[1]; } } break ; } } return map; } /* * Consttuct the canonical query string from the sorted parameter map. */ private string ConstructCanonicalQueryString(SortedDictionary< string , string > sortedParamMap) { StringBuilder builder = new StringBuilder(); if (sortedParamMap.Count == 0) { builder.Append( "" ); return builder.ToString(); } foreach (KeyValuePair< string , string > kvp in sortedParamMap) { builder.Append( this .PercentEncodeRfc3986(kvp.Key)); builder.Append( "=" ); builder.Append( this .PercentEncodeRfc3986(kvp.Value)); builder.Append( "&" ); } string canonicalString = builder.ToString(); canonicalString = canonicalString.Substring(0, canonicalString.Length - 1); return canonicalString; } } /* * To help the SortedDictionary order the name-value pairs in the correct way. */ class ParamComparer : IComparer< string > { public int Compare( string p1, string p2) { return string .CompareOrdinal(p1, p2); } } } |
(3)返回的xml为:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | <? xml version = "1.0" ?> < OperationRequest > < RequestId >2d95a9ad-5496-407a-a790-8d59b9ae7612</ RequestId > < Arguments > < Argument Name = "Operation" Value = "ItemLookup" /> < Argument Name = "Service" Value = "AWSECommerceService" /> < Argument Name = "Signature" Value = "qW/wz3d32Rc4yUEpn0Vp1LpAGfyyw7aHJYf+5PP7b5I=" /> < Argument Name = "AssociateTag" Value = "xxx" /> < Argument Name = "Version" Value = "2011-08-02" /> < Argument Name = "ItemId" Value = "B008GGCAVM" /> < Argument Name = "IdType" Value = "ASIN" /> < Argument Name = "AWSAccessKeyId" Value = "xxx" /> < Argument Name = "Timestamp" Value = "2013-06-13T09:43:49Z" /> < Argument Name = "ResponseGroup" Value = "Variations" /> </ Arguments > < RequestProcessingTime >0.0927190000000000</ RequestProcessingTime > </ OperationRequest > < Items > < Request > < IsValid >True</ IsValid > < ItemLookupRequest > < IdType >ASIN</ IdType > < ItemId >B008GGCAVM</ ItemId > < ResponseGroup >Variations</ ResponseGroup > < VariationPage >All</ VariationPage > </ ItemLookupRequest > </ Request > < Item > < ASIN >B008GGCAVM</ ASIN > < ParentASIN >B008GGCAVM</ ParentASIN > < VariationSummary > < LowestPrice > < Amount >19900</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$199.00</ FormattedPrice > </ LowestPrice > < HighestPrice > < Amount >24400</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$244.00</ FormattedPrice > </ HighestPrice > </ VariationSummary > < Variations > < TotalVariations >4</ TotalVariations > < TotalVariationPages >1</ TotalVariationPages > < VariationDimensions > < VariationDimension >DigitalStorageCapacity</ VariationDimension > < VariationDimension >Configuration</ VariationDimension > </ VariationDimensions > < Item > < ASIN >B0083PWAPW</ ASIN > < ParentASIN >B008GGCAVM</ ParentASIN > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > < ImageSets > < ImageSet Category = "primary" > < SwatchImage > < Height Units = "pixels" >30</ Height > < Width Units = "pixels" >30</ Width > </ SwatchImage > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < ThumbnailImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ ThumbnailImage > < TinyImage > < Height Units = "pixels" >110</ Height > < Width Units = "pixels" >110</ Width > </ TinyImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > </ ImageSet > </ ImageSets > < ItemAttributes > < Binding >Electronics</ Binding > < Brand >Amazon Digital Services Inc.</ Brand > < CatalogNumberList > < CatalogNumberListElement >53-000406</ CatalogNumberListElement > </ CatalogNumberList > < Color >Black</ Color > < EAN >2609000009136</ EAN > < EANList > < EANListElement >2609000009136</ EANListElement > < EANListElement >2609000005336</ EANListElement > < EANListElement >2609000005497</ EANListElement > < EANListElement >2609000006364</ EANListElement > < EANListElement >2609000005244</ EANListElement > < EANListElement >2609000009471</ EANListElement > < EANListElement >2609000006326</ EANListElement > < EANListElement >2412437002003</ EANListElement > < EANListElement >0848719003796</ EANListElement > < EANListElement >2097270920006</ EANListElement > < EANListElement >2720320491521</ EANListElement > < EANListElement >2486103219309</ EANListElement > < EANListElement >2609000009327</ EANListElement > < EANListElement >2609000006388</ EANListElement > </ EANList > < Feature >Stunning 1280x800 HD display with rich color and deep contrast from any viewing angle</ Feature > < Feature >Exclusive Dolby audio and dual driver stereo speakers for crisp, booming sound without distortion</ Feature > < Feature >Ultra-fast Wi-Fi- dual-antenna, dual-band Wi-Fi for 35% faster downloads and streaming</ Feature > < Feature >Over 22 million movies, TV shows, songs, magazines, books, audiobooks, and popular apps and games</ Feature > < ItemDimensions > < Height Units = "hundredths-inches" >40</ Height > < Length Units = "hundredths-inches" >760</ Length > < Weight Units = "hundredths-pounds" >87</ Weight > < Width Units = "hundredths-inches" >540</ Width > </ ItemDimensions > < Label >Amazon Digital Services, Inc</ Label > < ListPrice > < Amount >19900</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$199.00</ FormattedPrice > </ ListPrice > < Manufacturer >Amazon Digital Services, Inc</ Manufacturer > < Model >53-000406</ Model > < MPN >06550-611</ MPN > < PackageDimensions > < Height Units = "hundredths-inches" >140</ Height > < Length Units = "hundredths-inches" >1020</ Length > < Weight Units = "hundredths-pounds" >130</ Weight > < Width Units = "hundredths-inches" >730</ Width > </ PackageDimensions > < PackageQuantity >1</ PackageQuantity > < PartNumber >06550-611</ PartNumber > < ProductGroup >Amazon Devices</ ProductGroup > < ProductTypeName >ABIS_ELECTRONICS</ ProductTypeName > < Publisher >Amazon Digital Services, Inc</ Publisher > < ReleaseDate >2012-09-14</ ReleaseDate > < Studio >Amazon Digital Services, Inc</ Studio > < Title >Kindle Fire HD 7", Dolby Audio, Dual-Band Wi-Fi, 16 GB - Includes Special Offers</ Title > < UPC >848719003796</ UPC > < UPCList > < UPCListElement >848719003796</ UPCListElement > </ UPCList > </ ItemAttributes > < VariationAttributes > < VariationAttribute > < Name >DigitalStorageCapacity</ Name > < Value >16 GB</ Value > </ VariationAttribute > < VariationAttribute > < Name >Configuration</ Name > < Value >With Special Offers</ Value > </ VariationAttribute > </ VariationAttributes > < Offers > < Offer > < Merchant > < Name >Amazon.com</ Name > </ Merchant > < OfferAttributes > < Condition >New</ Condition > </ OfferAttributes > < OfferListing > < OfferListingId >ruHlLKYCVgCq%2Fy1vVUT3SyG%2B8XOmorXxvwjWh6c1jWD%2BjvcNUrK4FD80VFL0tvIvcgMcHIOHuqqT4%2FZ1YV3nenuwTufJ80wzkeLoGJbiqOCbKDYDyQPZ7A%3D%3D</ OfferListingId > < Price > < Amount >19900</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$199.00</ FormattedPrice > </ Price > < Availability >Usually ships in 24 hours</ Availability > < AvailabilityAttributes > < AvailabilityType >now</ AvailabilityType > < MinimumHours >0</ MinimumHours > < MaximumHours >0</ MaximumHours > </ AvailabilityAttributes > < IsEligibleForSuperSaverShipping >1</ IsEligibleForSuperSaverShipping > </ OfferListing > </ Offer > </ Offers > </ Item > < Item > < ASIN >B007T36PSM</ ASIN > < ParentASIN >B008GGCAVM</ ParentASIN > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > < ImageSets > < ImageSet Category = "primary" > < SwatchImage > < Height Units = "pixels" >30</ Height > < Width Units = "pixels" >30</ Width > </ SwatchImage > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < ThumbnailImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ ThumbnailImage > < TinyImage > < Height Units = "pixels" >110</ Height > < Width Units = "pixels" >110</ Width > </ TinyImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > </ ImageSet > </ ImageSets > < ItemAttributes > < Binding >Electronics</ Binding > < Brand >Amazon Digital Services Inc.</ Brand > < CatalogNumberList > < CatalogNumberListElement >53-000243</ CatalogNumberListElement > </ CatalogNumberList > < Color >Black</ Color > < EAN >0814916018321</ EAN > < EANList > < EANListElement >0814916018321</ EANListElement > </ EANList > < Feature >Stunning 1280x800 HD display with rich color and deep contrast from any viewing angle</ Feature > < Feature >Exclusive Dolby audio and dual driver stereo speakers for crisp, booming sound without distortion</ Feature > < Feature >Ultra-fast Wi-Fi- dual-antenna, dual-band Wi-Fi for 35% faster downloads and streaming</ Feature > < Feature >Over 22 million movies, TV shows, songs, magazines, books, audiobooks, and popular apps and games</ Feature > < HazardousMaterialType >Unknown</ HazardousMaterialType > < ItemDimensions > < Height Units = "hundredths-inches" >40</ Height > < Length Units = "hundredths-inches" >760</ Length > < Weight Units = "hundredths-pounds" >87</ Weight > < Width Units = "hundredths-inches" >540</ Width > </ ItemDimensions > < Label >Amazon Digital Services, Inc</ Label > < ListPrice > < Amount >21400</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$214.00</ FormattedPrice > </ ListPrice > < Manufacturer >Amazon Digital Services, Inc</ Manufacturer > < Model >53-000243</ Model > < MPN >CFU7516</ MPN > < PackageDimensions > < Height Units = "hundredths-inches" >140</ Height > < Length Units = "hundredths-inches" >1030</ Length > < Weight Units = "hundredths-pounds" >135</ Weight > < Width Units = "hundredths-inches" >730</ Width > </ PackageDimensions > < PackageQuantity >1</ PackageQuantity > < PartNumber >CFU7516</ PartNumber > < ProductGroup >Amazon Devices</ ProductGroup > < ProductTypeName >ABIS_ELECTRONICS</ ProductTypeName > < Publisher >Amazon Digital Services, Inc</ Publisher > < Studio >Amazon Digital Services, Inc</ Studio > < Title >Kindle Fire HD 7", Dolby Audio, Dual-Band Wi-Fi, 16 GB</ Title > < UPC >814916018321</ UPC > < UPCList > < UPCListElement >814916018321</ UPCListElement > </ UPCList > </ ItemAttributes > < VariationAttributes > < VariationAttribute > < Name >DigitalStorageCapacity</ Name > < Value >16 GB</ Value > </ VariationAttribute > < VariationAttribute > < Name >Configuration</ Name > < Value >Without Special Offers</ Value > </ VariationAttribute > </ VariationAttributes > < Offers > < Offer > < Merchant > < Name >Amazon.com</ Name > </ Merchant > < OfferAttributes > < Condition >New</ Condition > </ OfferAttributes > < OfferListing > < OfferListingId >dwLyPtT%2FSc1dJkfM9tPED82NtylpjyZto4nN2Mf8NNGYKPeUy6T1MP%2BM8HiySGRPBIPUwGIxJGO3yYYMMntN1q%2BpwNoXDyHA7Usy9CLBo4Y%2FDCQNpaqIMA%3D%3D</ OfferListingId > < Price > < Amount >21400</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$214.00</ FormattedPrice > </ Price > < Availability >Usually ships in 24 hours</ Availability > < AvailabilityAttributes > < AvailabilityType >now</ AvailabilityType > < MinimumHours >0</ MinimumHours > < MaximumHours >0</ MaximumHours > </ AvailabilityAttributes > < IsEligibleForSuperSaverShipping >1</ IsEligibleForSuperSaverShipping > </ OfferListing > </ Offer > </ Offers > </ Item > < Item > < ASIN >B008SYWFNA</ ASIN > < ParentASIN >B008GGCAVM</ ParentASIN > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > < ImageSets > < ImageSet Category = "primary" > < SwatchImage > < Height Units = "pixels" >30</ Height > < Width Units = "pixels" >30</ Width > </ SwatchImage > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < ThumbnailImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ ThumbnailImage > < TinyImage > < Height Units = "pixels" >110</ Height > < Width Units = "pixels" >110</ Width > </ TinyImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > </ ImageSet > </ ImageSets > < ItemAttributes > < Binding >Electronics</ Binding > < Brand >Amazon Digital Services Inc.</ Brand > < CatalogNumberList > < CatalogNumberListElement >53-000540</ CatalogNumberListElement > </ CatalogNumberList > < EAN >0848719007367</ EAN > < EANList > < EANListElement >0848719007367</ EANListElement > </ EANList > < Feature >Stunning 1280x800 HD display with rich color and deep contrast from any viewing angle</ Feature > < Feature >Exclusive Dolby audio and dual driver stereo speakers for crisp, booming sound without distortion</ Feature > < Feature >Ultra-fast Wi-Fi- dual-antenna, dual-band Wi-Fi for 35% faster downloads and streaming</ Feature > < Feature >Over 22 million movies, TV shows, songs, magazines, books, audiobooks, and popular apps and games</ Feature > < ItemDimensions > < Height Units = "hundredths-inches" >40</ Height > < Length Units = "hundredths-inches" >760</ Length > < Weight Units = "hundredths-pounds" >87</ Weight > < Width Units = "hundredths-inches" >540</ Width > </ ItemDimensions > < Label >Amazon Digital Services, Inc</ Label > < ListPrice > < Amount >24900</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$249.00</ FormattedPrice > </ ListPrice > < Manufacturer >Amazon Digital Services, Inc</ Manufacturer > < Model >53-000540</ Model > < PackageDimensions > < Height Units = "hundredths-inches" >140</ Height > < Length Units = "hundredths-inches" >1050</ Length > < Weight Units = "hundredths-pounds" >130</ Weight > < Width Units = "hundredths-inches" >740</ Width > </ PackageDimensions > < PackageQuantity >1</ PackageQuantity > < ProductGroup >Amazon Devices</ ProductGroup > < ProductTypeName >ABIS_ELECTRONICS</ ProductTypeName > < Publisher >Amazon Digital Services, Inc</ Publisher > < ReleaseDate >2012-10-25</ ReleaseDate > < Studio >Amazon Digital Services, Inc</ Studio > < Title >Kindle Fire HD 7", Dolby Audio, Dual-Band Wi-Fi, 32 GB - Includes Special Offers</ Title > < UPC >848719007367</ UPC > < UPCList > < UPCListElement >848719007367</ UPCListElement > </ UPCList > </ ItemAttributes > < VariationAttributes > < VariationAttribute > < Name >DigitalStorageCapacity</ Name > < Value >32 GB</ Value > </ VariationAttribute > < VariationAttribute > < Name >Configuration</ Name > < Value >With Special Offers</ Value > </ VariationAttribute > </ VariationAttributes > < Offers > < Offer > < Merchant > < Name >Amazon.com</ Name > </ Merchant > < OfferAttributes > < Condition >New</ Condition > </ OfferAttributes > < OfferListing > < OfferListingId >KqXiAzJNq45RORJMfymA%2F2XMjiIFi4aexRNhoCPM2uJ8n1tZilHPoZeVAe57Fy1f5XmF7l3DRWcC3NOs71xT5V0mXg7xU3GA9%2FsNEkycETCdSkDgdlXqpw%3D%3D</ OfferListingId > < Price > < Amount >22900</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$229.00</ FormattedPrice > </ Price > < AmountSaved > < Amount >2000</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$20.00</ FormattedPrice > </ AmountSaved > < PercentageSaved >8</ PercentageSaved > < Availability >Usually ships in 24 hours</ Availability > < AvailabilityAttributes > < AvailabilityType >now</ AvailabilityType > < MinimumHours >0</ MinimumHours > < MaximumHours >0</ MaximumHours > </ AvailabilityAttributes > < IsEligibleForSuperSaverShipping >1</ IsEligibleForSuperSaverShipping > </ OfferListing > </ Offer > </ Offers > </ Item > < Item > < ASIN >B009D7BJR4</ ASIN > < ParentASIN >B008GGCAVM</ ParentASIN > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > < ImageSets > < ImageSet Category = "primary" > < SwatchImage > < Height Units = "pixels" >30</ Height > < Width Units = "pixels" >30</ Width > </ SwatchImage > < SmallImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ SmallImage > < ThumbnailImage > < Height Units = "pixels" >75</ Height > < Width Units = "pixels" >75</ Width > </ ThumbnailImage > < TinyImage > < Height Units = "pixels" >110</ Height > < Width Units = "pixels" >110</ Width > </ TinyImage > < MediumImage > < Height Units = "pixels" >160</ Height > < Width Units = "pixels" >160</ Width > </ MediumImage > < LargeImage > < Height Units = "pixels" >500</ Height > < Width Units = "pixels" >500</ Width > </ LargeImage > </ ImageSet > </ ImageSets > < ItemAttributes > < Binding >Electronics</ Binding > < Brand >Amazon Digital Services Inc.</ Brand > < CatalogNumberList > < CatalogNumberListElement >53-000541</ CatalogNumberListElement > </ CatalogNumberList > < EAN >0848719007374</ EAN > < EANList > < EANListElement >0848719007374</ EANListElement > </ EANList > < Feature >Stunning 1280x800 HD display with rich color and deep contrast from any viewing angle</ Feature > < Feature >Exclusive Dolby audio and dual driver stereo speakers for crisp, booming sound without distortion</ Feature > < Feature >Ultra-fast Wi-Fi- dual-antenna, dual-band Wi-Fi for 35% faster downloads and streaming</ Feature > < Feature >Over 22 million movies, TV shows, songs, magazines, books, audiobooks, and popular apps and games</ Feature > < ItemDimensions > < Height Units = "hundredths-inches" >40</ Height > < Length Units = "hundredths-inches" >760</ Length > < Weight Units = "hundredths-pounds" >87</ Weight > < Width Units = "hundredths-inches" >540</ Width > </ ItemDimensions > < Label >Amazon Digital Services, Inc</ Label > < ListPrice > < Amount >26400</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$264.00</ FormattedPrice > </ ListPrice > < Manufacturer >Amazon Digital Services, Inc</ Manufacturer > < Model >53-000541</ Model > < PackageDimensions > < Height Units = "hundredths-inches" >140</ Height > < Length Units = "hundredths-inches" >1020</ Length > < Weight Units = "hundredths-pounds" >115</ Weight > < Width Units = "hundredths-inches" >740</ Width > </ PackageDimensions > < PackageQuantity >1</ PackageQuantity > < ProductGroup >Amazon Devices</ ProductGroup > < ProductTypeName >ABIS_ELECTRONICS</ ProductTypeName > < Publisher >Amazon Digital Services, Inc</ Publisher > < ReleaseDate >2012-10-25</ ReleaseDate > < Studio >Amazon Digital Services, Inc</ Studio > < Title >Kindle Fire HD 7", Dolby Audio, Dual-Band Wi-Fi, 32 GB</ Title > < UPC >848719007374</ UPC > < UPCList > < UPCListElement >848719007374</ UPCListElement > </ UPCList > </ ItemAttributes > < VariationAttributes > < VariationAttribute > < Name >DigitalStorageCapacity</ Name > < Value >32 GB</ Value > </ VariationAttribute > < VariationAttribute > < Name >Configuration</ Name > < Value >Without Special Offers</ Value > </ VariationAttribute > </ VariationAttributes > < Offers > < Offer > < Merchant > < Name >Amazon.com</ Name > </ Merchant > < OfferAttributes > < Condition >New</ Condition > </ OfferAttributes > < OfferListing > < OfferListingId >kj9vpb0SZNcO1ZzgNK4qFMkBVa81tjp2vNc%2B0uCglfpU9IDcM25ZVlkPBbJ4UWlTGeVKHV%2BqdDsueLrruY4l%2BjoMXAhB09BKowFsdsJgPw3qrdBrEYreOQ%3D%3D</ OfferListingId > < Price > < Amount >24400</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$244.00</ FormattedPrice > </ Price > < AmountSaved > < Amount >2000</ Amount > < CurrencyCode >USD</ CurrencyCode > < FormattedPrice >$20.00</ FormattedPrice > </ AmountSaved > < PercentageSaved >8</ PercentageSaved > < Availability >Usually ships in 24 hours</ Availability > < AvailabilityAttributes > < AvailabilityType >now</ AvailabilityType > < MinimumHours >0</ MinimumHours > < MaximumHours >0</ MaximumHours > </ AvailabilityAttributes > < IsEligibleForSuperSaverShipping >1</ IsEligibleForSuperSaverShipping > </ OfferListing > </ Offer > </ Offers > </ Item > </ Variations > </ Item > </ Items > </ ItemLookupResponse > |
很明显,其中的Variations下面:
通过TotalVariations知道有4个variation;
对应的4个Item,每个都有:
ASIN
SmallImage/MediumImage/LargeImage
等等详细的信息。
【总结】
给定某个产品ASIN:
如果是child的ASIN:则需要先去获得对应的ParentASIN;
如果本身是parent的ASIN,则可以直接其获得:所有的variation的详细的信息;
更多信息可参考:
http://docs.aws.amazon.com/AWSECommerceService/latest/DG/RG_Variations.html
相关参考:
【整理】C#版的AWS的ResponseGroup的Small示例代码
【整理】C#版的AWS的ResponseGroup的OfferSummary示例代码
【整理】C#版的AWS的ResponseGroup的ItemAttributes示例代码