Hi all, I'm using the following function in a Test Account to change Keyword labels. The problem is it randomly changes the labels, sometimes it will process just a few of my requests, sometimes half, sometimes none, there's really no coherent pattern to it. No errors are thrown.
In the example I'm using, the mysql query will return a total of 96 keywords that need label changes. Each keyword has 3 labels, so that's 96 * 3, plus each keyword already has 3 labels that need to be removed first, so that's a total of (96*3) * 2 (one REMOVE operation and one ADD operation). A total of 576 operations. It doesn't seem to make a difference if I send them all, or just 50, or just 10 at a time, the results are always inconsistent and the labels are NEVER all changes, only a few get processed. (and which ones seems to be quite random). In this example I'm limiting my request to just below 2000 operations (as suggested by the batch request documentation), although the total sent is never that much. function bulkCommitKeywordLabels($user, $accountName, $lType){ $conn = conn(); $q = mysqli_query($conn,"select `id`,`keywordId`,`adgroupId`,`oldLabelId`,`newLabelId` from `cronJobLabelUpdate` where `accountName` = '$accountName' and `labelType` = '$lType' and `outcome` = 'WAITING'"); $criterionService = $user->GetService('AdGroupCriterionService', ADWORDS_VERSION); $operations = array(); $requestLimit = 0; $cnt = 0; while($r = mysqli_fetch_assoc($q)){ $requestLimit++; if(trim($r['keywordId']) != '' && trim($r['adgroupId']) != ''){ $id = $r['id']; // Label to be removed $op1data = new AdGroupCriterionLabel($r['adgroupId'],$r[ 'keywordId'],$r['oldLabelId']); $op1 = new AdGroupCriterionLabelOperation(); $op1->operand = $op1data; $op1->operator = 'REMOVE'; $operations[] = $op1; // Label to be added $op2data = new AdGroupCriterionLabel($r['adgroupId'],$r[ 'keywordId'],$r['newLabelId']); $op2 = new AdGroupCriterionLabelOperation(); $op2->operand = $op2data; $op2->operator = 'ADD'; $operations[] = $op2; mysqli_query($conn,"update `cronJobLabelUpdate` set `outcome` = 'SENT' where `id` = '$id' limit 1"); }else{ echo '<br>Invalid KeywordId... Maybe?<br>'; } if($requestLimit >= 999){ // this is actually double since there's always a REMOVE and an ADD operation for each keywordID $cnt++; // commit changes, clear variables try{ $result = $criterionService->mutateLabel($operations); if($result->partialFailureErrors != NULL){ var_dump($result->partialFailureErrors); echo '<br>Count: '.$cnt.'<br>'; } }catch(Exception $e){ echo '<br>Error on Function (bulkCommitKeywordLabels)' . $e ->getMessage() .' count: '.$cnt; echo '<br>TERMINATING'; exit(); } $operations = array(); $requestLimit = 0; sleep(2); } } } Thanks for your help, -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 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. 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/9c90bad3-4c13-4a2b-ac4d-0763d7c3d40b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.