You are here:  » Amazon API v5 ?


Amazon API v5 ?

Submitted by DVDAFFAIRES on Sun, 2020-05-10 15:42 in

Hi David :o)

I hope to find everyone in good health!

I have a problem, I am restarting a site with a basic installation.
I installed v18/06A and some feeds without problem, everything works fine.
I wanted to test with the Amazon API here:
https://www.pricetapestry.com/node/6197

I have the Amazon tab (I deleted the ebay.php file).
The tab looks good but nothing happens if you click on it.
Example:
{link saved}
What does:
{link saved}

I tested on FF, Warefox, Edge and Chrome with the same result.
At Amamzon, I am in API V5

Do you have any idea what I did wrong?

Cheers,
Raoul :o)

Submitted by support on Mon, 2020-05-11 07:41

Hello Raoul,

The V5 API modules have a debug mode built-in so that you can view the raw API response - to do this add the following line to html/amazon.php:

  $amazonDebug = TRUE;

Then go to an Amazon tab, and the JSON API response should be displayed. If there is a problem with the request the response is normally quite informative, let me know if you're not sure where the problem lies from the output (or if no different of course, as that would indicate a connectivity rather than actual API issue).

Note from the comments in the Async API modules thread that some users have reported having to wait around 24 hours after migrating their access keys from AWS Console to Associates Central before results started showing...

Cheers,
David.
--
PriceTapestry.com

Submitted by DVDAFFAIRES on Mon, 2020-05-11 09:55

Hi David.

Thank you for your answer.

I just set up the line and it does nothing more, nothing is displayed.
The migration to V5 was done a long time ago and works well on other apps.

I took and installed this module, right?
https://www.pricetapestry.com/downloads?filename=AsyncAPI_Foundation.zip

I installed it as written here:
https://www.pricetapestry.com/node/6197

Did I miss something?

Cheers,
Raoul

Submitted by support on Mon, 2020-05-11 10:13

Hello Raoul,

That all looks fine - one thing to do now would be to check for any CURL error making the request. To do this, edit html/searchresults_amazon.php and look for the following code at line 73:

    $response = curl_exec($ch);

...and REPLACE with:

    $response = curl_exec($ch);
    if($amazonDebug)
    {
      print "[".curl_error($ch)."]";
    }

And then (with debug still enabled) make the request again and any CURL error will be displayed in [square brackets] - can you give that a go and let me know what (if anything!) is displayed...

Thanks,
David.
--
PriceTapestry.com

Submitted by DVDAFFAIRES on Mon, 2020-05-11 10:20

Hello David,

Still nothing is happening and nothing is displayed: o (
Example:
{link saved}

Raoul

Submitted by support on Mon, 2020-05-11 10:40

Hello Raoul,

Please could you drop me an email and I'll follow up that way - it looks like the Foundation tab functions are not in scope...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Mon, 2020-05-25 06:27

Hi

I haven't heard anything since API V5, it looks after message:

{"__type":"com.amazon.paapi5#TooManyRequestsException","Errors":[{"Code":"TooManyRequests","Message":"The request was denied due to request throttling. Please verify the number of requests made per second to the Amazon Product Advertising API."}]}

Do I need more orders? I don't think too many requests?

regards
Marco

Submitted by support on Mon, 2020-05-25 10:47

Hello Marco,

That does appear to be the generic message where insufficient sales have been driven - API limits are tiered based on sales.

What it might be worth doing instead of the "Sorry, no results found" message is to link to Amazon search results for the keyword(s) or product name with your generic associate URL. To try this, in html/searchresults_amazon.php and html/prices_amazon.php search for the following line;

  print "<p>".translate("Sorry, no results found")."</p>";

...and REPLACE with:

  print "<p><a href='https://www.amazon.co.uk/s?k=".urlencode($q)."&tag=YOUR-ASSOCIATE-TAG'>Search for ".$q." on Amazon...</a></p>";

(change .co.uk to your Amazon locale TLD and replace YOUR-ASSOCIATE-TAG with your Amazon Associates tracking tag)

Having applied the mod(s), browse to a page and bring up the Amazon results tab, right-click on the link and copy the URL being generated. Finally, login to your Amazon Associates account and go to Tools > Link Checker, paste the URL generated by the script into the box and test to double check everything is OK with the link...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Mon, 2020-05-25 18:06

hello David

the message "Sorry, no results found" no longer appears in my ABI V5?
Do I have to adjust more?

regards
Marco

Submitted by support on Tue, 2020-05-26 07:06

Hi Marco,

Ah - if you're using the original version (upgraded for PA API V5) instead, look for the following line;

  if (count($searchresults["products"])) require("html/searchresults.php");

...and REPLACE with:

  if (count($searchresults["products"]))
  {
    require("html/searchresults.php");
  }
  else
  {
    print "<p><a href='https://www.amazon.co.uk/s?k=".urlencode($q)."&tag=YOUR-ASSOCIATE-TAG'>Search for ".$q." on Amazon...</a></p>";
  }

(change .co.uk to your Amazon locale TLD and replace YOUR-ASSOCIATE-TAG with your Amazon Associates tracking tag)

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2020-05-26 07:15

hello David

For me it looks like this:

      if (count($searchresults["products"]))
      {
        require("searchresults_table.php");
      }
      else
      {
        print "<p>".translate("Sorry, no results found")."</p>";
      }

Edition does not belong.
"Sorry, no results found" is not output

Best regards
Marco

Submitted by support on Tue, 2020-05-26 07:23

Hi Marco,

Can you make sure debug mode is off now (delete $amazon_debug = TRUE; from html/amazon.php or change to FALSE) and let me know an example URL where the no results message is not being displayed (I'll remove before publishing your reply) so I can see the current output and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by MarcoCH on Tue, 2020-05-26 07:30

hello David

Example: {link saved}

Greets
Marco

Submitted by MarcoCH on Tue, 2020-05-26 08:04

hello David

It works thank you!

Great work as always!

Best regards
Marco