Amazon product api in php - php

I have a problem when trying to use Amazon product API. I have all my credentials, but when I send a request I get a 503 Status code with description
You are submitting requests too quickly. Please retry your requests at
a slower rate
I have tried a library called apai-io link: https://github.com/Exeu/apai-io.
I have also tried this code: https://www.patchesoft.com/amazon-affiliate-api-php#fullcode.
The weird thing is that I am sending only one request, trying to find a product with a specific ID. I would really be grateful if someone could give me some instructions or more information.

They are rate limiting the requests, see the discussion here
https://forums.aws.amazon.com/forum.jspa?forumID=9
And the policy here is new for the efficiency guidelines
Effective 23-Jan-2019, the request limit for each account is calculated based on revenue performance attributed to calls to the Product Advertising API (PA API) during the last 30 days.
Each account used for Product Advertising API is allowed an initial usage limit of 8640 requests per day (TPD) subject to a maximum of 1 request per second (TPS). Your account will receive an additional 1 TPD for every 5 cents or 1 TPS (up to a maximum of 10) for every $4320 of shipped item revenue generated via the use of Product Advertising API for shipments in the last 30 days.
https://docs.aws.amazon.com/AWSECommerceService/latest/DG/TroubleshootingApplications.html#efficiency-guidelines
This has impacted me too and it's counterintuitive imo, you have to sell to use API but cannot use the API if you don't sell.

Related

Twitter API V2 - Increase Rate Limit and Get Rate Limit Status

I'm using following Twitter APIs
https://developer.twitter.com/en/docs/twitter-api/tweets/manage-tweets/api-reference/post-tweets
https://developer.twitter.com/en/docs/twitter-api/tweets/retweets/api-reference/post-users-id-retweets
https://developer.twitter.com/en/docs/twitter-api/users/follows/api-reference/post-users-source_user_id-following
The rate limit for these APIs are https://developer.twitter.com/en/docs/twitter-api/rate-limits here.
Twitter API Rate Limit Image
The solutions I needed:
How can I increase the APIs rate limit?
I'm using https://developer.twitter.com/en/docs/twitter-api/v1/developer-utilities/rate-limit-status/api-reference/get-application-rate_limit_status API to get the APIs usage status, but it's returning same value in limit and remaining field. How can I get the exact usage details of APIs?
How I can get the daily API APP limits? The API seems to be returning 15 minutes limits, but I need to know how much app limit quota is remaining.
The post limits (Tweets, retweets, Direct Messages etc) are per-user quota. You can find out more about them from Twitter’s help pages.
The current technical limits for accounts are:
Direct Messages (daily): The limit is 1,000 messages sent per day.
Tweets: 2,400 per day. The daily update limit is further broken down into smaller limits for semi-hourly intervals. Retweets are counted as Tweets.
These limits are shared across all of the apps a user might use within a day. There is no API endpoint or header that shows what the current quota is - you have to account for this in your code.

When I upload excel with updated products with variants comes error (exceeded 2 calls per second for api client) in shopify Api

When I upload excel with updated products with variants comes error (exceeded 2 calls per second for api client) in shopify Api.
Like I have 1200 products and respective products have different variantd 1 ,2 3 etc.
when i will update that excel and then try to call api then some variant update but some are not update and give error
==>exceeded 2 calls per second for api client
so Please help me for this.
The error message is selft explanatory. It means you are exceeding the Shopify API call limit. More information on rate limitation is available on Shopify Website. It says
The API call limit operates using a leaky bucket algorithm as a
controller. The bucket empties at a leak rate of two calls per second,
which means that apps averaging two calls per second avoid bucket
errors.
To do so, you need to implement rate limiting in your application. As the PHP tag suggests you are using API via PHP, you can have a look at
Shopify PHP
It has a function checkApiCallLimit that ensures that your application does not exceed API rate limit.
$shopify = new PHPShopify\ShopifySDK($config);
Now any calls you make using shopify object, will respect the API rate limits. You can check the read me of linked library for more information.

Querying a payout via Stripe API

I am fetching the contributing transactions for a given payout token via the Stripe API (PHP). The query returns no errors, and shows 9 contributing transactions, all correct. However, the amounts shown did not add up to the total paid into the bank. I logged on to Stripe itself, searched for the given payout token, and was shown a listing of the transactions - except now there were 11! I've repeated the process a number of times, but each time I only get the same 9 transactions via the API instead of the complete 11 I get on their site.
Can anyone point me towards a solution? Is there some reason Stripe would truncate an API response for a single payout? I cannot see any mention of doing so in their documentation.
The answer lay in providing a 'limit' parameter to my request. It defaults to 10.

Trying to fetch instagram feeds for my website

I am using instagram feeds on my website, but due to traffic it is showing error as:
You have exceeded the maximum number of requests per hour. You have performed a total of 694 requests in the last hour. Our general maximum limit is set at 500 requests per hour
Try to cache your result from Instagram and update cache every hour. User will see cache without another request to your instagram feed api.
It sounds like you are still in sandbox. Switch to LIVE where they allow 5,000 requests per hour?
Global Rate Limits
Global rate limits are applied inclusive of all API calls made by an app per access token over the 1-hour sliding window, regardless of the particular endpoint. Rate limits also apply to invalid or malformed requests. Client Status Rate Limit:
Sandbox 500 / hour,
Live 5000 / hour

Instagram API: when is the rate limit increased for my client app?

I got an client app in sandbox for Instagram, was thinking of using it for showing a widget on client websites with their users recent media.
At the moment I am using GET requests towards this endpoint:
- api.instagram.com/v1/users/{user-id}/media/recent/?access_token=ACCESS-TOKEN
This is done on the server side, and it works good with my sandbox user. I save the data response from the API to avoid reaching the rate limit of 500 each hour. The saved response is then formatted to a html list, with links to the media. The request is only done once each day at the moment.
Is the rate limit only incremented on API calls as I thought? Do I avoid hitting the rate limit with this solution? If not: when is the rate limit incremented exactly?
Thanks in advance!
Yes, the rate limit will be decremented by 1 for your GET request. One way to keep track of the rate limit is to check the response headers from Instagram for x-ratelimit-remaining[1]. This will be set to an integer value (eg, 4990) and applies to the access_token used for the request. This method works only for GET requests; POST requests do not return accurate x-ratelimit-remaining values.
[1] As described in the deprecated developer documentation but inexplicably omitted from the current documentation.

Categories