I finally found the answer.
The hint is in the 
docs: https://developers.google.com/adwords/api/docs/guides/labels
But bonus mutateLabels is not a valid function for adgroups so digging into 
the library code I found "mutateLabel" and voila.
$adGroupService->mutateLabel($operations);
Is what you'll need.


On Friday, November 24, 2017 at 3:58:12 PM UTC-5, John VV wrote:
>
>
> I am using the PHP Library to add a label to an adGroup but having some 
> problems with the operation:
>
> $ad_group_id = '123456';
> $labels = array('78910');
> operations = array();
> foreach($labels as $label_id){
>       $adGroupLabel = new AdGroupLabel();
>       $adGroupLabel->setAdGroupId($ad_group_id);
>       $adGroupLabel->setLabelId($label_id);
>       $operation = new AdGroupLabelOperation();
>       $operation->setOperand($adGroupLabel);
>       $operation->setOperator(Operator::ADD);
>       $operations[] = $operation;
> }
> $result = $adGroupService->mutate($operations);
>
>
>
> But I get the error
> Unmarshalling Error: cvc-elt.4.3: Type 'ns1:AdGroupLabelOperation' is not 
> validly derived from the type definition, 'AdGroupOperation', of element 
> 'ns1:operations'. 
>
>
> Sadly there are very few examples of this so hopefully I can find some 
> insight in sharing my problem.
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/48671a09-12bd-4453-bd4e-8bc603d810a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to