Is there a C# code example of iterating over all the Campaigns,
AdGroups, and Keywords(Ads) where I'm interested in "get" the current
values to populate my local database? I did something similar in v13
but I'm having difficulties re-writing for v200909.
In particular, I'm having troubles "reading" (get) the Keyword (Ad)
MaxCPC and IsPaused information....
Partial code snippet:
//
==============================================================================
List<com.google.api.adwords.v200909.Campaign> googleCampaigns =
GoogleAPIHelper.GetAllCampaigns(networkUserName, logFile);
foreach (com.google.api.adwords.v200909.Campaign campaign in
googleCampaigns)
{
List<com.google.api.adwords.v200909.AdGroup> myAdGroups =
GoogleAPIHelper.GetAllAdGroupsByCampaignId(logFile, networkUserName,
campaign.id);
foreach (com.google.api.adwords.v200909.AdGroup adGroup in
myAdGroups)
{
List<com.google.api.adwords.v200909.Keyword> myKeywords =
GoogleAPIHelper.GetAllAdGroupCriteria(logFile, networkUserName,
adGroup.id);
foreach (com.google.api.adwords.v200909.Keyword kwd in
myKeywords)
{
// use Keyword fields to populate my Database record
(dbKeyword)
AdKeywordDataSet.AdKeyword_GoogleRow dbKeyword =
GetKeywordGoogleRowByGoogleId(adGroupGoogleId, kwd.id);
if (dbKeyword == null)
{
dbKeyword = keywordTable.NewAdKeyword_GoogleRow();
dbKeyword.AdGroupID = adGroupId;
dbKeyword.KeywordText = kwd.text;
dbKeyword.KeywordType =
GoogleAPIHelper.GetKeywordMatchType(kwd.matchType);
dbKeyword.GoogleID = kwd.id;
dbKeyword.GoogleStatus =
GoogleAPIHelper.GetAdStatus(ad.status); //
kwd.status.ToString();
com.google.api.adwords.v200909.AdGroupAd ad =
GoogleAPIHelper.GetAdByAdGroupId(logFile, networkUserName,
adGroupGoogleId, kwd.id);
dbKeyword.DestinationURL = ad.ad.url; //
kwd.destinationUrl;
decimal MaxCPC = Google.ToDecimal(kwd.maxCpc);
if (MaxCPC == 0)
{
MaxCPC = adGroupMaxCPC;
}
dbKeyword.MaxCPC = MaxCPC;
dbKeyword.IsPaused = kwd.paused;
keywordTable.AddAdKeyword_GoogleRow(dbKeyword);
keywordAdapter.Update(keywordTable);
}
}
}
}
//
==============================================================================
Also, it appears that my current migration is resulting in additional
API calls --- is that expected?
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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, reply using "remove me" as the subject.