AdWords API Re: C# - Getting COMPETITION and GLOBAL_MONTHLY_SEARCHES using TargetingIdeaService

2010-03-29 Thread Andy Nichols
Hi Eric,

I actually found and fixed this. The problem is I should have used get
rather than getBulkKeywordIdeas.

Andy

On 23 Mar, 03:50, AdWords API Advisor adwordsapiadvi...@google.com
wrote:
 Hi Andy,

 Are you making this request to the sandbox or production environment?
 Do you have the SOAP XML logs from this request?

 Best,
 - Eric Koleda, AdWords API Team

 On Mar 20, 2:08 pm, Andy Nichols andy.nichols.1...@googlemail.com
 wrote:

  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.TargetingIdeaS 
  ervice);

              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 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

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.


AdWords API C# - Getting COMPETITION and GLOBAL_MONTHLY_SEARCHES using TargetingIdeaService

2010-03-21 Thread Andy Nichols
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 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

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.