简体   繁体   中英

How to get product price on website with PA API

So i am completly new to the AWS and it seems very complicated at first. My plan was to get prices of products on my website using their ASIN. So i went to the scratchpad and tried my best, but no matter what i do i get an 503 error, saying im sending to many request to rapidly, which is obviously not the case. I tried it 4-5 times over the last 2 days, yet the same error remains.

In the support forum, i found people with a similiar problem and some answers stating that the new rules only make it possible for websites of high profit to send requests. Now my website is supposed to compare prices, and without showing the latest prices, my profit wont reach the point where i can send requests. This is what the Scratchpad gave me:

 <?php

 // Your Access Key ID, as taken from the Your Account page
 $access_key_id = "Here is my access key";

 // Your Secret Key corresponding to the above ID, as taken from the Your                Account page
 $secret_key = "Here is my secret key";

 // The region you are interested in
 $endpoint = "webservices.amazon.de";

 $uri = "/onca/xml";

 $params = array(
     "Service" => "AWSECommerceService",
     "Operation" => "ItemLookup",
     "AWSAccessKeyId" => "Here is my access-key",
     "AssociateTag" => "veganvergleic-21",
     "ItemId" => "B078B745K3",
     "IdType" => "ASIN",
     "ResponseGroup" => "ItemAttributes,Offers"
 );

 // Set current timestamp if not set
 if (!isset($params["Timestamp"])) {
     $params["Timestamp"] = gmdate('Y-m-d\TH:i:s\Z');
 }

 // Sort the parameters by key
 ksort($params);

 $pairs = array();

 foreach ($params as $key => $value) {
     array_push($pairs, rawurlencode($key)."=".rawurlencode($value));
 }

 // Generate the canonical query
 $canonical_query_string = join("&", $pairs);

 // Generate the string to be signed
 $string_to_sign = "GET\n".$endpoint."\n".$uri."\n".$canonical_query_string;

 // Generate the signature required by the Product Advertising API
 $signature = base64_encode(hash_hmac("sha256", $string_to_sign,      $secret_key, true));

 // Generate the signed URL
 $request_url =      'https://'.$endpoint.$uri.'?'.$canonical_query_string.'&Signature='.rawurlenco     de($signature);

 echo "Signed URL: \"".$request_url."\"";

 ?>

So if there is nothing wrong with what i did, and there is no way for me to send requests, how can i get the prices on my website using the ASIN? Im running out of ideas to get this to work.

Any help is highly appreciated!

Amazon product advertising API doesn't work properly if you don't already have a few sales. If you don't, you either need to scrape it yourself or use other third party API. We use the amazon-price API from RapidAPI, it supports price/rating/review count fetching for up to 1000 products in a single request.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM