Hello!
My developer token - tt-edFWwoiAxym9mInBh5w
Base level access
Client ID -
153150666737-5avm1rl87a1vetj4an9m4p34n516efju.apps.googleusercontent.com
I always get an RateExceededError(OperationsPerDay) error despite the fact
that I make a few requests in the Google AdWords API during the day.
I can not understand how can I fix this error.
Here is my code example, where I make a calls to AdWords API:
// Check API restriction
if ($checkRestriction) {
if ($adWordsParams->retry_after > 0) {
if ((time() - $adWordsParams->last_requested_at) <
$adWordsParams->retry_after) {
return $result;
}
}
}
try {
// Config
$conf = new Configuration([
'ADWORDS' => [
'developerToken' => $developerToken,
'clientCustomerId' => $adWordsParams->customer_id,
],
'OAUTH2' => [
'clientId' => $clientId,
'clientSecret' => $clientSecret,
'refreshToken' => $adWordsParams->oauth_refresh_token
],
]);
// Credentials
$oAuth2Credential = (new OAuth2TokenBuilder())->from($conf)->build();
// Session
$session = (new
AdWordsSessionBuilder())->from($conf)->withOAuth2Credential($oAuth2Credential)->enablePartialFailure()->build();
$adWordsServices = new AdWordsServices();
/** @var AdsSoapClient $adWordsService */
$adWordsService = $adWordsServices->get($session, $service);
$result = $adWordsService->$method($params);
if ($checkRestriction) {
$adWordsParams->last_requested_at = time();
$adWordsParams->retry_after = 0;
$adWordsParams->save();
}
} catch (ApiException $e) {
foreach ($e->getErrors() as $error) {
if ($error instanceof RateExceededError) {
$adWordsParams->retry_after = $error->getRetryAfterSeconds();
$adWordsParams->save();
LogHelper::error($shopID, '[AdWordsApiHelper запрос]: ' .
$error->getApiErrorType() . ' - ' . $error->getErrorString() . ' - ' .
$error->getRateName() . ' - ' . $error->getReason(),
LogHelper::CATEGORY_ADWORDS);
} else {
LogHelper::error($shopID, '[AdWordsApiHelper запрос]: ' .
$error->getApiErrorType() . ' - ' . $error->getErrorString(),
LogHelper::CATEGORY_ADWORDS);
}
}
$result = null;
}
return $result;
I check the RateExeedError and not make any requests to API, while it is no
time.
Please, understand what I am doing wrong?
Where in console.google.com can I check, how many requests are nade from my
developer token through my project?
Thanks!
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/31585be4-3706-4b7b-af2f-e0018d48450e%40googlegroups.com.