See the example code in the bidding guide: https://developers.google.com/adwords/api/docs/guides/bidding
it sets the bid on the adgroup, but the code to do the same on keywords should be similar. Oliver On Wednesday, March 27, 2013 8:35:52 AM UTC, F.Per wrote: > > Hi > > im using java (v201302) and i want to update a list of already EXISTING > keywords. I downloaded all the information i need about them and i want to > update their maxCpc. > Ive written the following code, but there is no obvious way for me to set > the maxCpc attribute: > > [code] > // create client login token > String clientLoginToken = new ClientLoginTokens.Builder() > .forApi(ClientLoginTokens.Api.ADWORDS) > .withEmailAndPassword("myEmail", "myPassword") > .build() > .requestToken(); > > // Construct an AdWordsSession. > AdWordsSession session = new > AdWordsSession.Builder().fromFile().withClientLoginToken(clientLoginToken).build(); > > AdWordsServices adWordsServices = new AdWordsServices(); > > try { > // Get the AdGroupService. > AdGroupServiceInterface adGroupService = > adWordsServices.get(session, AdGroupServiceInterface.class); > > List<AdGroupCriterionOperation> operationList = new > ArrayList<AdGroupCriterionOperation>(); > > // loop throuh existing keywords (google ids) > for(Long keywordId : keywordIds) { > Keyword googleKeyword = new Keyword(); > googleKeyword.setId(keywordId); > googleKeyword.setMatchType(KeywordMatchType.BROAD); > // how to update maxcpc ? > > BiddableAdGroupCriterion biddableAdGroupCriterion = new > BiddableAdGroupCriterion(); > biddableAdGroupCriterion.setAdGroupId(someAdGroupId); > biddableAdGroupCriterion.setCriterion(googleKeyword); > > AdGroupCriterionOperation adGroupCriterionOperation = new > AdGroupCriterionOperation(); > > adGroupCriterionOperation.setOperand(biddableAdGroupCriterion); > adGroupCriterionOperation.setOperator(Operator.SET); > > operationList.add(adGroupCriterionOperation); > > AdGroupOperation[] operations = (AdGroupOperation[]) > operationList.toArray(); > > // Update ad group. > AdGroupReturnValue result = > adGroupService.mutate(operations); > } > } catch (Exception e) { > e.printStackTrace(); > } > [/code] > > Either i am not getting how to set this or it has to be done in another > way. > > Can somebody help me with this? Id really appreciate it. > > thx > > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog and discussion group: http://adwordsapi.blogspot.com http://groups.google.com/group/adwords-api =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To post to this group, send email to adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/adwords-api?hl=en --- You received this message because you are subscribed to the Google Groups "AdWords API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.