In process of answering my own question. Using a test account, I set up an
infinite AWQL query loop that runs until it triggers a RATE_EXCEEDED error,
like so:
while(2 > 1) {
try {
$page = CampaignService->query('SELECT id, .....);
} catch (ApiException $apiException) {
foreach ($apiException->getErrors() as $error) {
$errorReason = $error->getReason();
if($errorReason == "RATE_EXCEEDED") {
$errArr = ([
'reason' => $error->getReason(),
'rateName' => $error->getRateName(),
'rateScope' => $error->getRateScope(),
'retryAfterSeconds' => $error->getRetryAfterSeconds()
]);
die(var_dump($errArr));
}
}
}
}
That fetches all the info there is about a RATE_EXCEEDED error. Next step
is actually handle the retryAfterSeconds with further API calls...
On Friday, April 28, 2017 at 6:48:42 PM UTC-7, Nick Harris wrote:
>
> I want to be able to properly handle RateExceededError as described in
> https://developers.google.com/adwords/api/docs/guides/rate-limits.
>
> Are there any code samples that show how to do this?
>
> Any way to simulate a RateExceededError so I can make sure my app handles
> it correctly? Or should I just launch thousands of concurrent API calls to
> generate a real error?
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/76675418-e637-469f-bc68-02ef8258f4a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.