Hi,

The CampaignTargetService is what you would use to set these targets
in v200909.  There is an example of how to use this service in .NET
here: 
http://code.google.com/p/google-api-adwords-dotnet/source/browse/trunk/Examples/v200906/AddCampaignTarget.cs.

Best,
- Eric Koleda, AdWords API Team

On Oct 28, 2:54 pm, Inah from Brazil <inahmart...@gmail.com> wrote:
> Hi!
> Im migratting from v13 to v2009 and I tryin'to addCampaign.
> Until now my method looks like:
>
> public SponsorResponse addCampaign(Campaign campaign, Boolean save) {
>                 SponsorResponse response = null;
>                 com.google.api.adwords.v200909.cm.Campaign campaign2009 = new
> com.google.api.adwords.v200909.cm.Campaign();
>                 CampaignServiceInterface campaignService = null;
>
>                 try {
>                         campaignService = user.getService
> (AdWordsService.V200909.CAMPAIGN_SERVICE);
>                 } catch (ServiceException e) {
>                         response = new SponsorResponse(false, e.getMessage(), 
> campaign);
>                 }
>                 CampaignOperation operation = new CampaignOperation();
>               operation.setOperand(campaign2009);
>               operation.setOperator(Operator.ADD);
>             try {
>                 campaign2009.setName(campaign.getName());
>                 campaign2009.setStartDate(campaign.getStartDate().toString());
>                 campaign2009.setEndDate(campaign.getEndDate().toString());
>                 campaign2009.setStatus(utils.convertGoogleCampaignStatus
> (campaign.getStatus()));
>                 if(campaign.getOptimized().equals("T")){
>                         campaign2009.setAdServingOptimizationStatus
> (AdServingOptimizationStatus.OPTIMIZE);
>                 }else{
>                         campaign2009.setAdServingOptimizationStatus
> (AdServingOptimizationStatus.ROTATE);
>                 }
>                 campaignService.mutate((new CampaignOperation[]{operation}));
>                 campaign.setCampaignCode((String.valueOf(campaign2009.getId
> ())));
>
>                 } catch (ApiException e) {
>                         response = new SponsorResponse(false, 
> auxiliar.dumpErrors(e),
> campaign);
>             return response;
>                 } catch (Exception e) {
>                         response = new SponsorResponse(false, e.getMessage(), 
> campaign);
>                         return response;
>                 }
>
>                 return response;
>         }
>
> I tryin to set the NetworkTarget, GeoTarget,  RegionTargets,
> CountryTargets and Language. In v13 my code looks like:
>
>  List<Net> nets = wizardCampaignDTO.getNet();
>         if (nets != null && nets.size() > 0) {
>             NetworkType[] nt = new NetworkType[nets.size()];
>             for (int i = 0; i < nets.size(); i++) {
>                 try {
>                     nt[i] = NetworkType.fromString(nets.get(i).getValue
> ());
>                 } catch (Exception e) {
>                     e.printStackTrace();
>                 }
>             }
>             c.setNetworkTargeting(nt);
>         }
>         List<Territory> territories = wizardCampaignDTO.getTerritory
> ();
>         List<Region> regions = wizardCampaignDTO.getRegion();
>         if (territories != null && territories.size() > 0) {
>             GeoTarget geo = new GeoTarget();
>
>             if (regions != null && regions.size() > 0) {
>
>                 RegionTargets regionTargets = new RegionTargets();
>                 String[] regionses = new String[regions.size()];
>                 for (int i = 0; i < regions.size(); i++) {
>                     regionses[i] = regions.get(i).getCodGoogle();
>                 }
>                 regionTargets.setRegions(regionses);
>                 geo.setRegionTargets(regionTargets);
>
>             } else {
>
>                 CountryTargets countryTargets = new CountryTargets();
>                 String[] countries = new String[territories.size()];
>                 for (int i = 0; i < territories.size(); i++) {
>                     countries[i] = territories.get(i).getValue();
>                 }
>                 countryTargets.setCountries(countries);
>                 geo.setCountryTargets(countryTargets);
>
>             }
>
>             c.setGeoTargeting(geo);
>         }
>
>         if (regions == null || regions.size() <= 0) {
>             List<Language> languages = wizardCampaignDTO.getLanguage
> ();
>             if (languages != null && languages.size() > 0) {
>                 String[] ls = new String[languages.size()];
>                 for (int i = 0; i < languages.size(); i++) {
>                     ls[i] = languages.get(i).getValue();
>                 }
>                 c.setLanguageTargeting(ls);
>             }
>         }
>
> I've NOoooOOO idea how to upgrate this to v2009...I saw
> CampaignServiceTarget but I not sure how I supoose to use that.....
> Sorry my bad english but..could someone please help me or any ideas?
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to