Hi
First of all, a great work by Google API team. New version does look
better. As the subject says, I am migrating from v201101 to v201109, I
faced some issue.
I want to get the targeted Languages and Locations which I have set
for a particular campaign ID.
Old code:
TargetList[] targets =
campaignManager.getGoogle().getCampaignTargets(new long[]
{ campaigns[i].getId() });
for (TargetList target : targets)
{
if (target instanceof GeoTargetList)
{
for (GeoTarget geoTarget :
((GeoTargetList) target).getTargets())
{
countryCode =
((CountryTarget) geoTarget).getCountryCode();
}
}
}
How do I do the same thing in new version? I have tried this, but I do
not know how to get countryCode now.
// Get the CampaignTargetService.
CampaignTargetServiceInterface campaignTargetService =
user.getService(AdWordsService.V201109.CAMPAIGN_TARGET_SERVICE);
long campaignId = campaigns[i].getId();
// Create selector.
CampaignTargetSelector selector = new
CampaignTargetSelector();
selector.setCampaignIds(new long[] {campaignId});
// Get all campaign targets.
CampaignTargetPage page =
campaignTargetService.get(selector);
// Display campaign targets.
if (page.getEntries() != null) {
for (TargetList targetList : page.getEntries()) {
System.out.println("Campaign target with
campaign id \""
+ targetList.getCampaignId()
+ "\" and of type \"" +
targetList.getTargetListType()
+ "\" was found.");
}
}
Thanks for your time.
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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