I was experimenting with Google AdWords' TargetingIdeaService to load keyword ideas based on a supplied keyword. I was exploring Requested Attribute Types and everything was going well. Then, all of a sudden I started getting InternalApiError.UNEXPECTED_INTERNAL_API_ERROR when doing the same requests. Since the only change I made between a good and a bad request was adding APPROX_CONTENT_IMPRESSIONS_PER_DAY Attrbitue Type, I removed it but to no avail. All subsequent calls end with the same error. I should also mention I'm doing it in the sandbox.
Here's my code:
try
{
AdWordsUser user = new AdWordsUser();
TargetingIdeaService tasService =
(TargetingIdeaService)user.GetService(AdWordsService.v200909.TargetingIdeaService);
// Obtain keyword
Console.Write("Enter keyword: ");
string keywordText = Console.ReadLine();
Keyword keyword = new Keyword();
keyword.text = keywordText;
keyword.matchTypeSpecified = true;
keyword.matchType = KeywordMatchType.BROAD;
RelatedToKeywordSearchParameter searchParam = new
RelatedToKeywordSearchParameter();
searchParam.keywords = new Keyword[] { keyword };
Paging paging = new Paging();
paging.numberResultsSpecified = true;
paging.startIndex = 0;
paging.numberResultsSpecified = true;
paging.numberResults = 10;
TargetingIdeaSelector selector = new TargetingIdeaSelector();
selector.searchParameters = new SearchParameter[] { searchParam };
selector.ideaTypeSpecified = true;
selector.ideaType = IdeaType.KEYWORD;
selector.requestTypeSpecified = true;
selector.requestType = RequestType.IDEAS;
selector.paging = paging;
selector.requestedAttributeTypes = new AttributeType[] {
AttributeType.AD_SHARE,
AttributeType.COMPETITION,
AttributeType.GLOBAL_MONTHLY_SEARCHES,
AttributeType.KEYWORD,
AttributeType.SEARCH_SHARE,
AttributeType.TARGETED_MONTHLY_SEARCHES,
AttributeType.APPROX_CONTENT_IMPRESSIONS_PER_DAY
};
TargetingIdeaPage page = tasService.get(selector);
if (page != null && page.entries != null)
{
Console.WriteLine("There are a total of {0} keywords related to
'{1}'. The first {2}" +
" entries are displayed below: \n", page.totalNumEntries,
keywordText,
page.entries.Length);
foreach (TargetingIdea idea in page.entries)
{
Console.WriteLine("************");
foreach (Type_AttributeMapEntry entry in idea.data)
{
switch (entry.key)
{
case AttributeType.KEYWORD:
Console.WriteLine("KW: " +
((KeywordAttribute)entry.value).value.text);
break;
case AttributeType.AD_SHARE:
Console.WriteLine("Ad share: " +
((DoubleAttribute)entry.value).value);
break;
case AttributeType.COMPETITION:
Console.WriteLine("Competition: " +
((DoubleAttribute)entry.value).value);
break;
case AttributeType.GLOBAL_MONTHLY_SEARCHES:
Console.WriteLine("Global Monthly searches: " +
((LongAttribute)entry.value).value);
break;
}
}
Console.WriteLine("************\n===");
}
}
else
{
Console.WriteLine("No related keywords were found for your
keyword.");
}
}
catch (Exception ex)
{
Console.WriteLine("Error retrieving kw ideas: " + ex.Message);
}
Any ideas as to what could be going wrong?
I'll gladly post request and response data as soon as I find an easy way to extract it.