How can i Retrieve the Location from adwords using the api?
I failed to get them im using java by the way and here is my code for
pulling the location from adwords .
public static void runExample(
AdWordsServices adWordsServices, AdWordsSession session) throws
Exception {
// Get the CampaignService.
CampaignCriterionServiceInterface campaignCriterionService =
adWordsServices.get(session,
CampaignCriterionServiceInterface.class);
int offset = 0;
// Create selector.
SelectorBuilder builder = new SelectorBuilder();
Selector selector = builder
.fields(
CampaignCriterionField.CampaignId,
CampaignCriterionField.Id,
CampaignCriterionField.CriteriaType,
CampaignCriterionField.PlatformName,
CampaignCriterionField.LanguageName,
CampaignCriterionField.LocationName,
CampaignCriterionField.KeywordText)
.in(CampaignCriterionField.CriteriaType, "KEYWORD", "LANGUAGE",
"LOCATION", "PLATFORM")
.offset(0)
.limit(PAGE_SIZE)
.equals(CampaignCriterionField.CampaignId,"235598893")
.build();
CampaignCriterionPage page = null;
do {
page = campaignCriterionService.get(selector);
//Location location =
(Location)campaignCriterionService.get(selector);
if (page.getEntries() != null) {
// Display campaigns.
for (CampaignCriterion campaignCriterion : page.getEntries()) {
//Location loc = (Location)campaignCriterion.getCriterion();
//System.out.println("hello"+loc.getLocationName());
System.out.printf("Campaign criterion with campaign id '%s',
criterion id '%s', "
+ "and type '%s' was found.\n",
campaignCriterion.getCampaignId(), campaignCriterion
.getCriterion().getId(),
campaignCriterion.getCriterion().getCriterionType());
}
Thread.sleep(1000);
} else {
System.out.println("No campaign criteria were found.");
}
offset += PAGE_SIZE;
selector = builder.increaseOffsetBy(PAGE_SIZE).build();
} while (offset < page.getTotalNumEntries());
Hope you can help me with this problem.. thanks in advance.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 http://groups.google.com/group/adwords-api.
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/20ee7df6-ece0-4f6c-b005-82b3075d0fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.