API v201607 DatabaseError.CONCURRENT_MODIFICATION

81 views
Skip to first unread message

mubbashar husain

unread,
Mar 23, 2017, 5:06:08 AM3/23/17
to AdWords API Forum
Hi,
I am using php sdk for change of adgroup bid using AdGroupCriterionService. I wanted to know that how can i finds out which adgroup bid change is successful and which one are not when i get DatabaseError.CONCURRENT_MODIFICATION. I only get SoapFault exception. Here is my code i am using to mutate the objects

$adProductService = $user->GetService('AdGroupCriterionService', ADWORDS_VERSION);
$oneProductGroup = new \BiddableAdGroupCriterion();

$oneProductGroup->adGroupId = $ad_group_id;
$oneProductGroup->criterion = new \Criterion($oneChangeLog->criterion_id);

$bid = new \CpcBid();

$newCpc = floatval(number_format($oneChangeLog->old_cpc, 2, '.', ''));

$newbidValue = $newCpc * \AdWordsConstants::MICROS_PER_DOLLAR;
//$newbidValue = round( $newbidValue );
$bid->bid = new \Money($newbidValue);

//$biddingStrategyConfiguration = $oneProductGroup->biddingStrategyConfiguration;
//p_rr($biddingStrategyConfiguration);
$biddingStrategyConfiguration = new \BiddingStrategyConfiguration();
$biddingStrategyConfiguration->bids[] = $bid;
$oneProductGroup->biddingStrategyConfiguration = $biddingStrategyConfiguration;

$operation = new \AdGroupCriterionOperation();
$operation->operand = $oneProductGroup;
$operation->operator = 'SET';
$operations[] = $operation;

$result = $adProductService->mutate($operations);


Sreelakshmi Sasidharan (AdWords API Team)

unread,
Mar 23, 2017, 12:00:00 PM3/23/17
to adwor...@googlegroups.com
Hi Mubbashar, 

In the event of DatabaseError.CONCURRENT_MODIFICATION, you will not be able to get the values of the specific operation that failed in the response. But please note that you will still have the request that was formed and was sent to the API. The best way to go about this would be have appropriate logger statements in your code which will help you trace each operation. Alternatively, you will also be able to get the criterion Id that was updated during a given time frame using the CustomerSyncService if the only update that you performed was the bid update. Here is a sample for CustomerSyncService.

You are likely to get CONCURRENT_MODIFICATION error if you are using multithreading, updating same keywords from multiple calls etc. My suggestion is to catch this error and retry the request with a delay of few seconds.

Let me know if you have any additional questions. 

Thanks,
Sreelakshmi, AdWords API Team

mubbashar husain

unread,
Mar 23, 2017, 1:43:30 PM3/23/17
to AdWords API Forum
Actually i want to find out which one fail. as we submit in batch and i got exception so i don't know which one is fail. can you provide me some to get the adgroups which are successful and which are not

thanks!

Sreelakshmi Sasidharan (AdWords API Team)

unread,
Mar 23, 2017, 4:01:56 PM3/23/17
to AdWords API Forum
Hi Mubbashar, 

Could you please Reply privately to author and share a sample SOAP response XML while you are getting the CONCURRENT_MODIFICATION exception? I believe, you should still have the index of the operation in your response logs and it should help you find out which operation failed and which operation succeeded in the batch job. The index of the operation in the response will match the order in which you have submitted the operation in your code. 

I would like to verify if you are seeing something different in your logs. 
Reply all
Reply to author
Forward
0 new messages