Is it possible to use conditional operation execution on BatchJobService?

23 views
Skip to first unread message

Justinas Ringaila

unread,
Apr 19, 2016, 2:28:11 PM4/19/16
to AdWords API Forum
Hi, 
I'm trying to update Ad (actually to remove it and recreate new one with updated fields).
I created two operations:
 operations = new[]
                {
                    new AdGroupAdOperation
                    {
                        @operator = Operator.ADD,
                        operand = adGroupAd
                    },
                    new AdGroupAdOperation
                    {
                        @operator = Operator.REMOVE,
                        operand = new AdGroupAd
                        {
                            adGroupId = adGroupAd.adGroupId,
                            ad = new Ad {id = oldId}
                        },
                    }
                };

Then the array of these operations is sent through BatchJobService at once (will be generated one batch job Id). I want to be sure that before removing the ad, the new one was created. In case of failure to create Ad I don't want to remove the old one. Is it possible to achieve it using just one batch job call to Adwords api? 

Shwetha Vastrad (AdWords API Team)

unread,
Apr 19, 2016, 4:46:50 PM4/19/16
to AdWords API Forum
Hi Justinas,

I don't think a single BatchJob call will be able to do this. If you want to remove and recreate an Ad, I would recommend that you follow the steps below
  1. Create the new ad in the PAUSED state.
  2. Wait for the new ad's approvalStatus to become APPROVED.
  3. Issue a subsequent single mutate request with two operations: a) Set the new ad to ENABLED and b) Set the old ad to DISABLED.
This should ensure that the old ad is only disabled once the new ad is running.

I hope this helps.

Regards,
Shwetha, AdWords API Team.

Reply all
Reply to author
Forward
0 new messages