Hi Ben,

Please see attached file for my complete Java code for setting bid modifier 
in a placement. Also, as a suggestion, please enable your SOAP logs if you 
haven't done so by following the "Configuring logging" section of this 
document 
<https://github.com/googleads/googleads-php-lib#configuring-logging>. The 
SOAP logs is helpful to know if your request is successful, or if there are 
errors, you can check for the actual reason of the error.

Thanks,
Vincent
AdWords API Team

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

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
--- 
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 [email protected].
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/44e38f78-eb06-4b13-98d4-41b29de18337%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
// Copyright 2017 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package adwords.axis.v201708.campaignmanagement;

import com.google.api.ads.adwords.axis.factory.AdWordsServices;
import com.google.api.ads.adwords.axis.v201708.cm.AdGroupCriterionOperation;
import com.google.api.ads.adwords.axis.v201708.cm.AdGroupCriterionReturnValue;
import 
com.google.api.ads.adwords.axis.v201708.cm.AdGroupCriterionServiceInterface;
import com.google.api.ads.adwords.axis.v201708.cm.BiddableAdGroupCriterion;
import com.google.api.ads.adwords.axis.v201708.cm.Operator;
import com.google.api.ads.adwords.axis.v201708.cm.Placement;
import com.google.api.ads.adwords.axis.v201708.cm.Platform;
import com.google.api.ads.adwords.lib.client.AdWordsSession;
import com.google.api.ads.adwords.lib.factory.AdWordsServicesInterface;
import com.google.api.ads.common.lib.auth.OfflineCredentials;
import com.google.api.ads.common.lib.auth.OfflineCredentials.Api;
import com.google.api.client.auth.oauth2.Credential;

/**
 * This example sets a bid modifier for the mobile platform on given campaign.
 * To get campaigns, run basicoperations/GetCampaigns.java.
 *
 * <p>Credentials and properties in {@code fromFile()} are pulled from the
 * "ads.properties" file. See README for more info.
 */
public class SetBidModifierInPlacement {

  private static final double BID_MODIFIER = 1.5;

  public static void main(String[] args) throws Exception {
    // Generate a refreshable OAuth2 credential.
    Credential oAuth2Credential = new OfflineCredentials.Builder()
        .forApi(Api.ADWORDS)
        .fromFile()
        .build()
        .generateCredential();

    // Construct an AdWordsSession.
    AdWordsSession session = new AdWordsSession.Builder()
        .fromFile()
        .withOAuth2Credential(oAuth2Credential)
        .build();

    AdWordsServicesInterface adWordsServices = AdWordsServices.getInstance();
    
    runExample(adWordsServices, session);
  }

  public static void runExample(
      AdWordsServicesInterface adWordsServices, AdWordsSession session)
      throws Exception {

    Platform mobile = new Platform();
    mobile.setId(XXXXXXX);
    
    Placement urlPlacement = new Placement();
    urlPlacement.setId(XXXXXXXXXXXXXXXXX);
    urlPlacement.setUrl("site.www.hello.com");

    // Create criterion with modified bid.
    BiddableAdGroupCriterion adGroupCriterion = new BiddableAdGroupCriterion();
    adGroupCriterion.setAdGroupId(XXXXXXXXXXXXXXXXX);
    adGroupCriterion.setCriterion(urlPlacement);
    adGroupCriterion.setBidModifier(BID_MODIFIER);
    
    AdGroupCriterionOperation operation = new AdGroupCriterionOperation();
    operation.setOperand(adGroupCriterion);
    operation.setOperator(Operator.SET);
    
    AdGroupCriterionServiceInterface adGroupCriterionService =
    adWordsServices.get(session, AdGroupCriterionServiceInterface.class);
    
    AdGroupCriterionReturnValue result =
        adGroupCriterionService.mutate(new AdGroupCriterionOperation[] 
{operation});
    
  }
}

  • Where can I chec... bruce
    • Re: Where c... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
      • Re: Whe... bruce
        • Re:... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
          • ... bruce
            • ... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
              • ... bruce
              • ... bruce
                • ... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
                • ... bruce
                • ... 'Vincent Racaza (AdWords API Team)' via AdWords API Forum
                • ... bruce

Reply via email to