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.


AdWords API Re: v2009 CampaignService: no username/password?

2010-03-21 Thread quaylar
Yes, credentials are set in the AdWordsUser-object. If you use the
standard-constructor, username and password
will be read from the app.config and used to generate the authToken.

You can use the alternative constructor which takes a dictionary of
header-values as input-argument. See AccountServiceNoConfigDemo.cs
to see which header-values you have to pass.

cheers,

On 20 Mrz., 01:21, BeeGeez  wrote:
> I'm trying to use the CampaignSelector to loop through all my
> Campaigns but the example in the GetAllCampaigns.cs class doesn't use
> a username/password.  How do I set up the credentials to use the right
> account for the Campaign Service?  Is it set in the AdWordsUser
> somehow?  If so, can I get an VB.NET (or C#) code example how to do
> this?
>
> I also looked at the examples in the client libraries but I it seems
> like username/password is only used in v13.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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.