Eirc, Here is the code that I am running. Some keywords work fine, others do not yield any category results. However the same keywords DO yield category results when examined through the AdWords web UI. Am I missing a component? Also I have included a RelatedToKeywordSearchParameter withn the searchParameters array because the API says that certain search parameters are required and I did not want to associate the search with any URL specific search criteria.
Let me know what you think. Thanks, Tony // Create seed keyword. Keyword keyword = new Keyword(); keyword.text = keywordText; keyword.matchType = KeywordMatchType.EXACT; // Create selector. TargetingIdeaSelector selector = new TargetingIdeaSelector(); selector.requestType = RequestType.STATS; selector.ideaType = IdeaType.KEYWORD; selector.requestedAttributeTypes = new AttributeType[] { AttributeType.CRITERION, AttributeType.KEYWORD_CATEGORY }; // Set selector paging (required for targeting idea service). Paging paging = new Paging(); paging.startIndex = 0; paging.numberResults = 100; selector.paging = paging; // Create related to keyword search parameter. RelatedToKeywordSearchParameter relatedToKeywordSearchParameter = new RelatedToKeywordSearchParameter(); relatedToKeywordSearchParameter.keywords = new Keyword[] { keyword }; // Create keyword match type search parameter to ensure unique results. KeywordMatchTypeSearchParameter keywordMatchTypeSearchParameter = new KeywordMatchTypeSearchParameter(); keywordMatchTypeSearchParameter.keywordMatchTypes = new KeywordMatchType[] { KeywordMatchType.EXACT }; selector.searchParameters = new SearchParameter[] { relatedToKeywordSearchParameter, keywordMatchTypeSearchParameter }; //selector.searchParameters = new SearchParameter[] { keywordMatchTypeSearchParameter }; try { TargetingIdeaPage page = targetingIdeaService.get(selector); if (page != null && page.entries != null) { Console.WriteLine("There are a total of {0} entries related to '{1}'.", page.totalNumEntries, keywordText); foreach (TargetingIdea idea in page.entries) { foreach (Type_AttributeMapEntry entry in idea.data) { if (entry.key == AttributeType.CRITERION) { CriterionAttribute kwdAttribute = entry.value as CriterionAttribute; Console.WriteLine("Related keyword with text = '{0}' and match type = '{1}'" + " was found.", (kwdAttribute.value as Keyword).text, (kwdAttribute.value as Keyword).matchType); } if (entry.key == AttributeType.KEYWORD_CATEGORY) { IntegerSetAttribute kwdCategories = entry.value as IntegerSetAttribute; if (kwdCategories.value != null && kwdCategories.value.Length > 0) { foreach (int catID in kwdCategories.value) { Console.WriteLine("CategoryID: " + catID.ToString()); } } else { Console.WriteLine("No category returned. Press enter."); Console.ReadLine(); } } } } } else { Console.WriteLine("No related keywords were found for your keyword."); } } On Jul 25, 6:34 pm, Eric Koleda <eric.kol...@google.com> wrote: > Hi Tony, > > We attempt to write sample code that covers a wide array of topics, but > there will always be use cases that aren't shown. If you use requestType > STATS for your request then you will only get data for the specific keywords > you requested, and you can set the matchType to EXACT on the source keywords > to get the data you are looking for. The TargetingIdeaService also supports > the KeywordCategoryIdSearchParameter for retrieving keywords that belong to > a certain category. You won't be able to retrieve all the keywords in that > category though, as the service only return up to 800 results. > > http://code.google.com/apis/adwords/docs/reference/latest/TargetingId... > > Best, > - Eric -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 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