首页 > 大数据 > 数据挖掘 > 亚马逊国际获得AMAZON商品详情 API 返回值说明
通过亚马逊提供的Product Advertising API(也称为Amazon PA API),你可以获取商品的详细信息。这个API允许开发者查询亚马逊的商品数据,包括商品标题、价格、描述、图片链接等。在使用API时,返回的JSON或XML数据可能包含各种代码,这些代码通常用于描述状态、错误或其他信息。
以下是一个简化的例子,展示了通过Amazon PA API获取商品详情时可能返回的数据结构(以JSON格式为例):
json复制代码
|
|
{ |
|
|
"ItemLookupResponse": { |
|
|
"Request": { |
|
|
"IsValid": "True", |
|
|
"ItemLookupRequest": [ |
|
|
{ |
|
|
"IdType": "ASIN", |
|
|
"ItemId": "B00006I5IE", |
|
|
"ResponseGroup": "ItemAttributes,Offers,Images,Reviews" |
|
|
} |
|
|
] |
|
|
}, |
|
|
"Items": { |
|
|
"Request": { |
|
|
"ItemId": "B00006I5IE" |
|
|
}, |
|
|
"Item": { |
|
|
"ASIN": "B00006I5IE", |
|
|
"ItemAttributes": { |
|
|
"Brand": "Sony", |
|
|
"Binding": "Electronics", |
|
|
"EAN": "0711519111486", |
|
|
"Feature": [ |
|
|
"Enjoy rich, vibrant audio with 9mm neodymium drivers", |
|
|
"Listen longer with up to 35 hours of battery life", |
|
|
"Stay comfortable with ergonomic, noise-cancelling design" |
|
|
], |
|
|
"ItemDimensions": { |
|
|
"Height": "6.70 inches", |
|
|
"Length": "6.50 inches", |
|
|
"Width": "1.70 inches", |
|
|
"Weight": "4.8 ounces" |
|
|
}, |
|
|
// 更多属性... |
|
|
}, |
|
|
"Offers": { |
|
|
"TotalOffers": "1", |
|
|
"TotalOfferPages": "1", |
|
|
"MoreOffersUrl": "http://www.amazon.com/gp/offer-listing/B00006I5IE/ref=sr_1_1?ie=UTF8&qid=1472973070&sr=8-1", |
|
|
"Offer": { |
|
|
"Merchant": { |
|
|
"Name": "Amazon.com", |
|
|
"Rating": { |
|
|
"AverageRating": "4.8 out of 5 stars", |
|
|
"TotalVotes": "14967" |
|
|
} |
|
|
}, |
|
|
"OfferListing": { |
|
|
"OfferListingId": "7T8V2O8X9D8H4V4N", |
|
|
"Price": { |
|
|
"Amount": "12999", |
|
|
"CurrencyCode": "USD", |
|
|
"FormattedPrice": "$129.99" |
|
|
}, |
|
|
"Availability": "Usually ships within 24 hours", |
|
|
"AvailabilityAttributes": { |
|
|
"AvailabilityType": "NOW", |
|
|
"IsEligibleForPrime": "true" |
|
|
}, |
|
|
// 更多优惠信息... |
|
|
} |
|
|
} |
|
|
}, |
|
|
"Images": { |
|
|
"PrimaryImage": { |
|
|
"URL": "http://ecx.images-amazon.com/images/I/51w9E1g%2B6XL._SL1500_.jpg", |
|
|
"HeightPixels": 1500, |
|
|
"WidthPixels": 1500 |
|
|
}, |
|
|
// 更多图片信息... |
|
|
}, |
|
|
"EditorialReviews": { |
|
|
"EditorialReview": [ |
|
|
{ |
|
|
"Source": "Product Description", |
|
|
"Content": "Experience rich, vibrant audio with the Sony MDR-NC100D Noise-Cancelling Headphones. These..." |
|
|
}, |
|
|
// 更多评论... |
|
|
] |
|
|
}, |
|
|
// 更多商品信息... |
|
|
} |
|
|
}, |
|
|
"Error": { |
|
|
// 如果发生错误,这里将包含错误代码和消息 |
|
|
"Code": null, |
|
|
"Message": null, |
|
|
"BytesProcessed": null, |
|
|
"RequestId": null |
|
|
} |
|
|
} |
|
|
} |
在API调用过程中,如果发生错误,
Error部分将包含相关信息。常见的错误代码包括:
AWS.ECommerceService.NoExactMatches: 未找到精确匹配的商品。AWS.ECommerceService.ItemNotFound: 商品未找到。AWS.ECommerceService.InvalidAssociateTag: 无效的关联标签(Access Key)。AWS.ECommerceService.InvalidOperation: 无效的操作。AWS.ECommerceService.InvalidParameterCombination: 无效的参数组合。AWS.ECommerceService.InvalidParameterValue: 无效的参数值。AWS.ECommerceService.InternalFailure: 内部服务错误。通过检查这些代码,你可以更好地理解API调用的结果,并据此处理错误情况。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70042344/viewspace-3056798/ ,如需转载,请注明出处,否则将追究法律责任。