Change Campaign Status [OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]

228 views
Skip to first unread message

testm...@gmail.com

unread,
Apr 15, 2015, 11:06:07 AM4/15/15
to adwor...@googlegroups.com
Hi,

Im trying to change Campaignstatus.
But i always get the Error:

[OperatorError.OPERATOR_NOT_SUPPORTED @ operations[0]]

This is how I do it:
Does someone know what I am doing wrong here?

            var client = new CampaignService.CampaignService();

           
           
//create Campaign with Status
           
Campaign campaign = new Campaign();
            campaign
.id = CurrentCampaignId;

           
switch (index)
           
{
               
case 0:
                    campaign
.status=CampaignStatus.ENABLED;
                   
break;
               
case 1:
                    campaign
.status=CampaignStatus.PAUSED;
                   
break;
               
case 2:
                    campaign
.status=CampaignStatus.REMOVED;
                   
break;
           
}

           
//Create the Operation
           
CampaignOperation operation = new CampaignOperation();
            operation
.operand = campaign;
            operation
.operatorSpecified = true;
            operation
.@operator= Operator.REMOVE;
           
           
           
try
           
{
                client
.PreAuthenticate = true;
                client
.UseDefaultCredentials = true;
                client
.RequestHeader = new SoapHeader
               
{
                    clientCustomerId
= clientCustomerId,
                    developerToken
= "XXXXXXXXXXXXXXXXXXXXX",
                    partialFailure
= false,
                    userAgent
= "AdWordsChangeStatus",
                    validateOnly
= false,
               
};
                client
.PreAuthenticate = true;

               
CampaignReturnValue returnValue = client.mutate(new CampaignOperation[] {operation});

               
if (returnValue != null && returnValue.value != null && returnValue.value.Length > 0)
               
{
                   
Campaign changedCampaign = returnValue.value[0];
               
}
               
else
               
{
                   
Console.WriteLine("No status has changed");
               
}

           
}
           
catch (Exception ex)
           
{
               
throw new System.ApplicationException("Failed to change status", ex);
           
}  


Thank you very much

Danial Klimkin

unread,
Apr 15, 2015, 11:08:42 AM4/15/15
to adwor...@googlegroups.com
Hello,


You need to use the "SET" operator if you want to update any field, including the 'status' field.


-Danial, AdWords API Team.

Michael D

unread,
Apr 16, 2015, 9:54:23 AM4/16/15
to adwor...@googlegroups.com

If I use Operation.SET instead of Operation.REMOVE the same Error occurs!

Are there some other mistakes?

Danial Klimkin

unread,
Apr 16, 2015, 11:01:05 AM4/16/15
to adwor...@googlegroups.com
Any chance you are trying to change the status of a REMOVED campaign?


-Danial.

Michael D

unread,
Apr 17, 2015, 11:30:21 AM4/17/15
to adwor...@googlegroups.com
Yes you are right. Im trying to change the status of a removed campaign.

So its not possible to change the status of a removed campaign back to paused or enabled?

But this is what fiddler gives me. There is no operation in it.

POST https://adwords.google.com/api/adwords/cm/v201409/CampaignService HTTP/1.1
User-Agent: Mono Web Services Client Protocol 4.0.50524.0
Authorization: Bearer ya29.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
Content-Length: 658
Host: adwords.google.com

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">

<soap:Header>
<RequestHeader xmlns="https://adwords.google.com/api/adwords/cm/v201409">
<clientCustomerId>XXXXXXXXXX</clientCustomerId>
<developerToken>XXXXXXXXXXXXXXXXXXX</developerToken>
<userAgent>AdWordsChangeCampaign</userAgent>
</RequestHeader>
</soap:Header>

<soap:Body>
<mutate xmlns="https://adwords.google.com/api/adwords/cm/v201409">
<operations>
<operator>SET</operator>
<operand>
<id>270327786</id>
</operand></operations>
</mutate>
</soap:Body>
</soap:Envelope>


Danial Klimkin

unread,
Apr 20, 2015, 8:38:41 AM4/20/15
to adwor...@googlegroups.com
Hello Michael,


No, removed objects can not be re-enabled. It was possible in the older API versions but not anymore.


-Danial, AdWords API Team.

Michael D

unread,
Apr 20, 2015, 9:08:07 AM4/20/15
to adwor...@googlegroups.com
Hello Daniel,

Ok, so I can just change the status of a paused or an active campaign.

When I try to pause a Campaign this is what my sniffer shows me:
But there is no value for the status in it. In my first the first Post you can see how this soap is created.
Looks ike this is a Problem of serialization in Mono :( or do I miss something else?
Thank you very much

Danial Klimkin

unread,
Apr 20, 2015, 9:11:00 AM4/20/15
to adwor...@googlegroups.com
Hello Michael,


It doesn't look the request was formed properly. Are you using any of our client libraries?



-Danial, AdWords API Team.

Michael D

unread,
Apr 20, 2015, 9:19:59 AM4/20/15
to adwor...@googlegroups.com
Ok,

I solved it. It was a Problem with the serialization.

Thank you for your help ;)


Reply all
Reply to author
Forward
0 new messages