ADD AdGroupOperation

26 views
Skip to first unread message

phpoo

unread,
Nov 25, 2009, 3:11:04 PM11/25/09
to AdWords API Forum

Hi
eu tenho um erro no meu script mas não entendo
I'm trying to add a AdGroup and returns me an error.The section of
code that the error is this

$operations = array(new AdGroupOperation(NULL, $adgroup1, 'ADD'));
$adgroupReturnValue = $AdGroupService->mutate($operations); #Add
campaigns.

When the print $operations command returns that
Array ( [0] => AdGroupOperation Object ( [operand] => [operator] =>
AdGroup Object (

And the error that returns is this
SoapFault Object ( [message:protected] => [RequiredError.REQUIRED @
operations[0].operator, OperatorError.OPERATOR_NOT_SUPPORTED @
operations[0]]

Can anyone help me?

AdWords API Advisor

unread,
Nov 25, 2009, 6:01:37 PM11/25/09
to AdWords API Forum
Hi,

I believe the order of the objects in your constructor is wrong. It
should be:

$operations = array(new AdGroupOperation($adgroup1, 'ADD', NULL));

Best,
- Eric Koleda, AdWords API Team

phpoo

unread,
Nov 26, 2009, 10:37:56 AM11/26/09
to AdWords API Forum
Ok, I do not understand I was using the example of folder "/examples/
v200909/AddAllCampaigns.php" not found in the documentation something
told me to ADD AdGroups was another order of operation, and now to ADD
TextAd is not so "new AdGroupAdOperation ($adText, NULL, 'ADD')"?

thanks
P.W

On Nov 25, 8:01 pm, AdWords API Advisor <adwordsapiadvi...@google.com>
wrote:

AdWords API Advisor

unread,
Nov 30, 2009, 10:39:46 AM11/30/09
to AdWords API Forum
Hi P.W.,

The order of the parameters to the constructor for the different
operations (CampaignOperation, AdGroupOperation, AdGroupAdOperation)
are not consistent. This is because these classes are automatically
generated from the WSDL files and the order cannot be manipulated for
consistency. As an alternative, create the object with an empty
constructor and set the fields manually in an order of your choosing:

$operation = new AdGroupAdOperation();
$operation->operand = $adText;
$operation->operator = 'ADD';

Best,
- Eric
Reply all
Reply to author
Forward
0 new messages