Amazon API5 AV DVD

Product Advertising API 5.0 Scratchpad の SearchItems で、AVを検索することができない。BrowsNode を指定してみても明らかだ。


{
 "Keywords": "架乃ゆら",
 "Resources": [
  "BrowseNodeInfo.BrowseNodes",
  "Images.Primary.Medium",
  "ItemInfo.Title",
  "Offers.Listings.Price"
 ],
 "SearchIndex": "MoviesAndTV",
 "BrowseNodeId": "16378461",
 "PartnerTag": "a-hadaka-22",
 "PartnerType": "Associates",
 "Marketplace": "www.amazon.co.jp",
 "Operation": "SearchItems"
}
Product Advertising API Scratchpad (beta) Start Tour History 10 Support Select operation BROWSENODE GetBrowseNodes ITEM GetVariations GetItems SearchItems Common parameters Marketplace The locale where you are making the request. Partner Type The type of Amazon business entity. Partner Tag a-hadaka-22 Tag that uniquely identifies you as a Partner. In case of Associates, enter your Store Id. Access Key AKIAIUTTAF4LZT4MPBSA Your Access Key which uniquely identifies you. Secret Key •••••••••••••••••••••••••••••••••••••••• A key that is used in conjunction with the Access Key to cryptographically sign an API request. To retrieve your Access Key or Secret Key, refer to Becoming Product Advertising API Developer. SearchItems SearchItems operation searches for items on Amazon using keywords and other refinement options. Request parameters Name Value Description Keywords 架乃ゆら A word or phrase that describes an item i.e. the search query. Resources BrowseNodeInfo BrowseNodeInfo.BrowseNodesBrowseNodeInfo.BrowseNodes.AncestorBrowseNodeInfo.BrowseNodes.SalesRankBrowseNodeInfo.WebsiteSalesRank CustomerReviews CustomerReviews.CountCustomerReviews.StarRating Images Images.Primary.SmallImages.Primary.MediumImages.Primary.LargeImages.Variants.SmallImages.Variants.MediumImages.Variants.Large ItemInfo ItemInfo.ByLineInfoItemInfo.ContentInfoItemInfo.ContentRatingItemInfo.ClassificationsItemInfo.ExternalIdsItemInfo.FeaturesItemInfo.ManufactureInfoItemInfo.ProductInfoItemInfo.TechnicalInfoItemInfo.TitleItemInfo.TradeInInfo Offers Offers.Listings.Availability.MaxOrderQuantityOffers.Listings.Availability.MessageOffers.Listings.Availability.MinOrderQuantityOffers.Listings.Availability.TypeOffers.Listings.ConditionOffers.Listings.Condition.SubConditionOffers.Listings.DeliveryInfo.IsAmazonFulfilledOffers.Listings.DeliveryInfo.IsFreeShippingEligibleOffers.Listings.DeliveryInfo.IsPrimeEligibleOffers.Listings.DeliveryInfo.ShippingChargesOffers.Listings.IsBuyBoxWinnerOffers.Listings.LoyaltyPoints.PointsOffers.Listings.MerchantInfoOffers.Listings.PriceOffers.Listings.ProgramEligibility.IsPrimeExclusiveOffers.Listings.ProgramEligibility.IsPrimePantryOffers.Listings.PromotionsOffers.Listings.SavingBasisOffers.Summaries.HighestPriceOffers.Summaries.LowestPriceOffers.Summaries.OfferCount ParentASIN ParentASIN RentalOffers RentalOffers.Listings.Availability.MaxOrderQuantityRentalOffers.Listings.Availability.MessageRentalOffers.Listings.Availability.MinOrderQuantityRentalOffers.Listings.Availability.TypeRentalOffers.Listings.BasePriceRentalOffers.Listings.ConditionRentalOffers.Listings.Condition.SubConditionRentalOffers.Listings.DeliveryInfo.IsAmazonFulfilledRentalOffers.Listings.DeliveryInfo.IsFreeShippingEligibleRentalOffers.Listings.DeliveryInfo.IsPrimeEligibleRentalOffers.Listings.DeliveryInfo.ShippingChargesRentalOffers.Listings.MerchantInfo SearchRefinements SearchRefinements Resources for SearchItems operation which specify the values to return in the API response. SearchIndex MoviesAndTV Indicates the product category to search. SearchIndex values differ by marketplace. For list of search index values, refer Locale Reference . BrowseNodeId 16378461 A unique ID assigned by Amazon that identifies a product category/sub-category. The BrowseNodeId is a positive Long having max value upto Long.MAX_VALUE i.e. 9223372036854775807 (inclusive). Add a new parameter Select parameter Request details Endpoint webservices.amazon.co.jp/paapi5/searchitems Headers Host: webservices.amazon.co.jp X-Amz-Date: 20200404T154915Z X-Amz-Target: com.amazon.paapi5.v1.ProductAdvertisingAPIv1.SearchItems Content-Encoding: amz-1.0 JSON Payload Copy { "Keywords": "架乃ゆら", "Resources": [ "BrowseNodeInfo.BrowseNodes", "Images.Primary.Medium", "ItemInfo.Title", "Offers.Listings.Price" ], "SearchIndex": "MoviesAndTV", "BrowseNodeId": "16378461", "PartnerTag": "a-hadaka-22", "PartnerType": "Associates", "Marketplace": "www.amazon.co.jp", "Operation": "SearchItems" } 1 { 2 "Keywords": "架乃ゆら", 3 "Resources": [ 4 "BrowseNodeInfo.BrowseNodes", 5 "Images.Primary.Medium", 6 "ItemInfo.Title", 7 "Offers.Listings.Price" 8 ], 9 "SearchIndex": "MoviesAndTV", 10 "BrowseNodeId": "16378461", 11 "PartnerTag": "a-hadaka-22", 12 "PartnerType": "Associates", 13 "Marketplace": "www.amazon.co.jp", 14 "Operation": "SearchItems" 15 } Signed Request Copy https://webservices.amazon.co.jp/!YW16LTEuMDtjb20uYW1hem9uLnBhYXBpNS52MS5Qcm9kdWN0QWR2ZXJ0aXNpbmdBUEl2MS5TZWFyY2hJdGVtczt7CiAgICAiS2V5d29yZHMiOiAiGSIsCiAgICAiUmVzb3VyY2VzIjogWwogICAgICAgICJCcm93c2VOb2RlSW5mby5Ccm93c2VOb2RlcyIsCiAgICAgICAgIkltYWdlcy5QcmltYXJ5Lk1lZGl1bSIsCiAgICAgICAgIkl0ZW1JbmZvLlRpdGxlIiwKICAgICAgICAiT2ZmZXJzLkxpc3RpbmdzLlByaWNlIgogICAgXSwKICAgICJTZWFyY2hJbmRleCI6ICJNb3ZpZXNBbmRUViIsCiAgICAiQnJvd3NlTm9kZUlkIjogIjE2Mzc4NDYxIiwKICAgICJQYXJ0bmVyVGFnIjogImEtaGFkYWthLTIyIiwKICAgICJQYXJ0bmVyVHlwZSI6ICJBc3NvY2lhdGVzIiwKICAgICJNYXJrZXRwbGFjZSI6ICJ3d3cuYW1hem9uLmNvLmpwIgp9 Response types Rendered response JSON response HTML response Copy HTTP Status: 200: OK | Response Time: 370 ms | Request ID: 80193cc8-11db-4137-b256-22ca56790108 Code snippets JAVA PHP cURL Copy setRegionName($region); $awsv4->setServiceName($serviceName); $awsv4->setPath ($uriPath); $awsv4->setPayload ($payload); $awsv4->setRequestMethod ("POST"); $awsv4->addHeader ('content-encoding', 'amz-1.0'); $awsv4->addHeader ('content-type', 'application/json; charset=utf-8'); $awsv4->addHeader ('host', $host); $awsv4->addHeader ('x-amz-target', 'com.amazon.paapi5.v1.ProductAdvertisingAPIv1.SearchItems'); $headers = $awsv4->getHeaders (); $headerString = ""; foreach ( $headers as $key => $value ) { $headerString .= $key . ': ' . $value . "\r\n"; } $params = array ( 'http' => array ( 'header' => $headerString, 'method' => 'POST', 'content' => $payload ) ); $stream = stream_context_create ( $params ); $fp = @fopen ( 'https://'.$host.$uriPath, 'rb', false, $stream ); if (! $fp) { throw new Exception ( "Exception Occured" ); } $response = @stream_get_contents ( $fp ); if ($response === false) { throw new Exception ( "Exception Occured" ); } echo $response; class AwsV4 { private $accessKey = null; private $secretKey = null; private $path = null; private $regionName = null; private $serviceName = null; private $httpMethodName = null; private $queryParametes = array (); private $awsHeaders = array (); private $payload = ""; private $HMACAlgorithm = "AWS4-HMAC-SHA256"; private $aws4Request = "aws4_request"; private $strSignedHeader = null; private $xAmzDate = null; private $currentDate = null; public function __construct($accessKey, $secretKey) { $this->accessKey = $accessKey; $this->secretKey = $secretKey; $this->xAmzDate = $this->getTimeStamp (); $this->currentDate = $this->getDate (); } function setPath($path) { $this->path = $path; } function setServiceName($serviceName) { $this->serviceName = $serviceName; } function setRegionName($regionName) { $this->regionName = $regionName; } function setPayload($payload) { $this->payload = $payload; } function setRequestMethod($method) { $this->httpMethodName = $method; } function addHeader($headerName, $headerValue) { $this->awsHeaders [$headerName] = $headerValue; } private function prepareCanonicalRequest() { $canonicalURL = ""; $canonicalURL .= $this->httpMethodName . "\n"; $canonicalURL .= $this->path . "\n" . "\n"; $signedHeaders = ''; foreach ( $this->awsHeaders as $key => $value ) { $signedHeaders .= $key . ";"; $canonicalURL .= $key . ":" . $value . "\n"; } $canonicalURL .= "\n"; $this->strSignedHeader = substr ( $signedHeaders, 0, - 1 ); $canonicalURL .= $this->strSignedHeader . "\n"; $canonicalURL .= $this->generateHex ( $this->payload ); return $canonicalURL; } private function prepareStringToSign($canonicalURL) { $stringToSign = ''; $stringToSign .= $this->HMACAlgorithm . "\n"; $stringToSign .= $this->xAmzDate . "\n"; $stringToSign .= $this->currentDate . "/" . $this->regionName . "/" . $this->serviceName . "/" . $this->aws4Request . "\n"; $stringToSign .= $this->generateHex ( $canonicalURL ); return $stringToSign; } private function calculateSignature($stringToSign) { $signatureKey = $this->getSignatureKey ( $this->secretKey, $this->currentDate, $this->regionName, $this->serviceName ); $signature = hash_hmac ( "sha256", $stringToSign, $signatureKey, true ); $strHexSignature = strtolower ( bin2hex ( $signature ) ); return $strHexSignature; } public function getHeaders() { $this->awsHeaders ['x-amz-date'] = $this->xAmzDate; ksort ( $this->awsHeaders ); // Step 1: CREATE A CANONICAL REQUEST $canonicalURL = $this->prepareCanonicalRequest (); // Step 2: CREATE THE STRING TO SIGN $stringToSign = $this->prepareStringToSign ( $canonicalURL ); // Step 3: CALCULATE THE SIGNATURE $signature = $this->calculateSignature ( $stringToSign ); // Step 4: CALCULATE AUTHORIZATION HEADER if ($signature) { $this->awsHeaders ['Authorization'] = $this->buildAuthorizationString ( $signature ); return $this->awsHeaders; } } private function buildAuthorizationString($strSignature) { return $this->HMACAlgorithm . " " . "Credential=" . $this->accessKey . "/" . $this->getDate () . "/" . $this->regionName . "/" . $this->serviceName . "/" . $this->aws4Request . "," . "SignedHeaders=" . $this->strSignedHeader . "," . "Signature=" . $strSignature; } private function generateHex($data) { return strtolower ( bin2hex ( hash ( "sha256", $data, true ) ) ); } private function getSignatureKey($key, $date, $regionName, $serviceName) { $kSecret = "AWS4" . $key; $kDate = hash_hmac ( "sha256", $date, $kSecret, true ); $kRegion = hash_hmac ( "sha256", $regionName, $kDate, true ); $kService = hash_hmac ( "sha256", $serviceName, $kRegion, true ); $kSigning = hash_hmac ( "sha256", $this->aws4Request, $kService, true ); return $kSigning; } private function getTimeStamp() { return gmdate ( "Ymd\THis\Z" ); } private function getDate() { return gmdate ( "Ymd" ); } } ?>
関連記事

コメント

非公開コメント

フリーエリア

ハダカ画像集 RSS

https://a-hadaka.jp/modules/myalbum/rss.php
loading