I am having trouble migrating from v13 GetKeywordsFromSite to v200909
TargetingIdeaService. I can get a list of keywords, but I can't work
out how to get COMPETITION and GLOBAL_MONTHLY_SERVICES values.
Code is as below. I would be grateful for any help.
AdWordsUser user = new AdWordsUser();
// Get the service.
TargetingIdeaService service =
(TargetingIdeaService)user.GetService(AdWordsService.v200909.TargetingIdeaService);
TargetingIdeaSelector selector = new
TargetingIdeaSelector();
selector.ideaType = IdeaType.KEYWORD;
selector.ideaTypeSpecified = true;
selector.requestType = RequestType.IDEAS;
selector.requestTypeSpecified = true;
selector.requestedAttributeTypes = new AttributeType[]
{ AttributeType.KEYWORD,
AttributeType.GLOBAL_MONTHLY_SEARCHES,
AttributeType.COMPETITION };
RelatedToUrlSearchParameter param = new
RelatedToUrlSearchParameter();
param.urls = new string[] { url };
selector.searchParameters = new SearchParameter[]
{ param };
Paging paging = new Paging();
paging.startIndex = 0;
paging.startIndexSpecified = true;
paging.numberResults = 100;
paging.numberResultsSpecified = true;
selector.paging = paging;
// Get a list of keywords for this site.
TargetingIdeaPage mySiteKeywordGroups =
service.getBulkKeywordIdeas(selector);
TargetingIdea[] keywords = mySiteKeywordGroups.entries;
foreach (TargetingIdea keywordFromAPI in keywords)
{
foreach (Type_AttributeMapEntry entry in
keywordFromAPI.data)
{
if (entry.key == AttributeType.KEYWORD)
{
//Code is entering here - and I can read the
keyword text
}
else if (entry.key == AttributeType.COMPETITION)
{
//entry.key is never COMPETITION
}
else if (entry.key ==
AttributeType.GLOBAL_MONTHLY_SEARCHES)
{
//entry.key is never GLOBAL_MONTHLY_SEARCHES
}
}
}
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Have you migrated to v200909 yet?
The v13 sunset is on April 22, 2010.
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
To unsubscribe from this group, send email to
adwords-api+unsubscribegooglegroups.com or reply to this email with the words
"REMOVE ME" as the subject.