Hi
I am developing app in java where I need to Add Campaigns within those Campaigns AdGroups, and for those AdGroups their repesctive keywords. So fo adding Ad Group we need Campaign ID, and for adding keywords need AdGroup ID.
So for now I am doing like this :
First Adding Batch of Campiagns like below :
CampaignOperation[] campaignOperations = new CampaignOperation[ ] { cOp1, cOp2, cOp3};
// Add campaigns.
CampaignReturnValue addResult = campaignService.mutate(campaignOperations);
// Retriving IDs for added campians
Then I Add AdGroups To Respective Campaigns using Campaign IDs I got, as below :
AdGroupOperation[] adAdGroupsOperations = new AdGroupOperation[] { cOp1AdGrp1, cOp1AdGrp2, cOp1AdGrp3, cOp2AdGrp1, cOp2AdGrp2, cOp3AdGrp1,};
// Add ad groups.
AdGroupReturnValue result = adGroupService.mutate(adAdGroupsOperations);
// I retriev Group IDs here
Then I Add Keywords To Respective AdGroups using AdGroup IDs I got, as below :
AdGroupCriterionOperation[] keywordsOperations = new AdGroupCriterionOperation[ cOp1AdGrp1KeywrdOp1, cOp1AdGrp1KeywrdOp1, .................., cOp[N]AdGrp[N]KeywrdOp[N];
// Add keywords.
AdGroupCriterionReturnValue result = adGroupCriterionService
.mutate(keywordsOperations);
Above code will do like :
1] Adds Campaigns,
2] Adds AdGroups to respective Campaigns,
3] Adds Keywords to Respective AdGroups,
Now my problem is that if any of these fails I need to roll back,
Is there any way to rollback changes made by perticular session
OR
Is there any way that I can do like this :
1] Create nested operations
mainOperation {
CampaignOperation1 {
AdGroupOperation1, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation2, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation3, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation4, {
KeywordOperation1,
KeywordOperation2,
}
},
CampaignOperation1 {
AdGroupOperation1, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation2, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation3, {
KeywordOperation1,
KeywordOperation2,
}
AdGroupOperation4, {
KeywordOperation1,
KeywordOperation2,
}
}
}
2] And then add these operations in single batch.
Is this possible, and how ?