Hi Matt, The reason for the original error is that there are fields on a Campaign object that are read only, and cannot be set during a mutate operation. In general, the best practice is to create a new instance of the object and only set the changed and required fields.
Best, - Eric Koleda, AdWords API Team On Oct 15, 10:05 pm, "[email protected]" <[email protected]> wrote: > I figured it out. > The trick is to create a NEW DTO. > In this case a new Campaign. Set your data on that and than pass it to > your mutator. > Also, learned it's imperative to set your bid. > > On Oct 15, 1:37 pm, "[email protected]" > > > > <[email protected]> wrote: > > Hi, > > I am new to the forum and new to the AdWords API. I am using the Java > > client v5.1.0 and am having some trouble when I update a campaign. > > > Here is my java code: > > > CampaignServiceInterface campaignService = > > user.getService(AdWordsService.V200906.CAMPAIGN_SERVICE); > > > CampaignPage campaignPage = campaignService.get(new > > CampaignSelector > > ()); > > Campaign campaign = campaignPage.getEntries(1); > > System.out.println(campaign.getName()); > > System.out.println(campaign.getStatus()); > > campaign.setStatus(CampaignStatus.ACTIVE); > > campaign.setBiddingStrategy(new ManualCPC()); > > Budget budget = new Budget(BudgetBudgetPeriod.DAILY, new > > Money(null, > > 50000000L), > > BudgetBudgetDeliveryMethod.STANDARD); > > campaign.setBudget(budget); > > > CampaignOperation operation = new CampaignOperation(); > > operation.setOperand(campaign); > > operation.setOperator(Operator.SET); > > CampaignReturnValue result = campaignService.mutate(new > > CampaignOperation[] { operation }); > > > And here is the generated soap request. > > I see that the issue is due to the soap including a change for > > servingStatus, but the question is am I doing something wrong? > > > <mutate xml > > ns="https://adwords.google.com/api/adwords/cm/v200906"> > > <operations><operator>SET</operator><operand> > > <id>50567601</id> > > <name>Sample Walrus Campaign</name> > > <status>ACTIVE</status> > > <servingStatus>SERVING</servingStatus> > > <startDate>20091015</startDate> > > <endDate>20371231</endDate> > > <budget><period>DAILY</period><amount><ComparableValue.Type>Money</ > > ComparableValue.Type><microAmount>1000000</microAmount></amoun > > t><deliveryMethod>STANDARD</deliveryMethod></budget> > > <biddingStrategy xsi:type="ns2:ManualCPC" xmlns:ns2="https:// > > adwords.google.com/api/adwords/cm/ > > v200906"><BiddingStrategy.Type>ManualCPC</BiddingStrategy.Type></ > > biddingStrategy><autoKeywordMatchingStatus>OPT_OUT</ > > autoKeywordMatchingStatus><stats><network>ALL</ > > network><Stats.Type>Stats</Stats.Type></ > > stats><frequencyCap><impressions>0</impressions>< > > /frequencyCap> > > </operand></operations> > > </mutate> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
