Hi Jan,

I think that can be avoided if the access token is cached and only 
requested when the access token is about to expire. 
I'm asking the PHP library maintainer for comments. 

Best,
- Takeshi, 

On Thursday, July 25, 2013 5:23:24 AM UTC+9, Jan Catrysse wrote:
>
> Hello,
>
> We've updated to adWords API v201306 and switched from simple login to 
> OAuth2. We are using one MCC account to access multiple underlying customer 
> accounts. OAuth2 is working fine when accessing only a few 
> ClientCustomerId’s.
>
> A “User Rate Limit Exceeded” error is occurring when spawning multiple 
> processes (lets say 20), getting some info from CampaignService. It seems 
> that this is not an adWords error, but a Google API error (OAUTH 2), when 
> refreshing the authtoken to often. This is however handled by the PHP 
> Client Library…
> We’ve made sure that “new AdWordsUser()” and “GetAuthToken()” is called 
> before the fork and “SetClientCustomerId()” and “GetService()” inside the 
> fork. It is our understanding that the php client library should handle the 
> refresh token afterwards…
>
> What are we doing wrong? It is not possible to change the rate limits for 
> AdWords inside Google API…
>
> Thanks,
> Jan
>
> How is the script made up (simplified, just to get the idea):
>
>> <?php
>> $user = new AdWordsUser();
>> $user->SetOAuth2Info(
>>     array('client_id' => CONFIG_GAPI_CLIENT_ID,
>>     'client_secret' => CONFIG_GAPI_CLIENT_SECRET,
>>     'refresh_token' => CONFIG_GAPI_REFRESH_TOKEN)
>> );
>> $user->SetUserAgent(CONFIG_GAPI_USERAGENT);
>> $user->SetDeveloperToken(CONFIG_GAPI_DEVELOPER_TOKEN);
>> $user->SetApplicationToken(CONFIG_GAPI_APPLICATION_TOKEN);
>> $user->GetAuthToken();
>>
>> $aAccounts = array('account', 'anotheraccount', 'andanother');
>> $children = array();
>> $i=0;
>> while ($i < count($aAccounts)) {
>>     $customerId = $aAccounts[$i];
>>     if (($pid = pcntl_fork()) === 0){
>>         // Child process
>>         try {
>>             $user->SetClientCustomerId($customerId);
>>             $campaignService = $user->GetService('CampaignService', 
>> 'v201306');
>>             $selector = new Selector();
>>             $selector->fields = array('Status', 'StartDate', 'EndDate', 
>> 'Id');
>>             $selector->paging = new Paging(0, 10);
>>             do {
>>                 // Make the get request.
>>                 $page = $campaignService->get($selector);
>>                 $selector->paging->startIndex += 10;
>>             } while ($page->totalNumEntries > 
>> $selector->paging->startIndex);
>>         } catch (Exception $e) {
>>             echo $e->getTraceAsString();
>>         }
>>         exit();
>>     }else if ($pid){
>>         // Parent process
>>         $children[] = $pid;
>>     }
>>     $i++;
>> }
>> ?>
>>
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://adwordsapi.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
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 adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to