Zero Records from Campaign !!!

43 views
Skip to first unread message

Senthil Palaniswami

unread,
Oct 15, 2015, 11:39:59 AM10/15/15
to AdWords API Forum
Hi All,
 
I am using C# console app to get the Campaign records into text files. I got the developer token granted and approved. But when I run the below code ,I see it is getting access but no records from GoogleAdwords. Any thought ???  No Errors though !!!
 
Below is my code
 

AdWordsAppConfig config = user.Config as AdWordsAppConfig;

config.OAuth2Mode = OAuth2Flow.APPLICATION;

config.OAuth2ClientId = "XXXXXXX.apps.googleusercontent.com";

config.OAuth2ClientSecret = "SDSGDFGDFSGDFSGDFSGDSFGD";

config.DeveloperToken = "AAAAAAAAAAAAAAAAAAAAAAAA";

config.ClientCustomerId = "123-456-7890";

config.Email = "XXX...@gmail.com";

config.Password = "$#$#$#$";

config.OAuth2RefreshToken = "XXXXXXXXXXXDDDDDDDDDDDDSSSSSSSSn6zK6XiATCKT";

// Get the CampaignService.

 

CampaignService campaignService = (CampaignService)user.GetService(AdWordsService.v201506.CampaignService);

// Create the selector.

Selector selector = new Selector();

selector.fields = new string[] { "Id", "Name" };

 

 

// Set the selector paging.

selector.paging = new Paging();

int offset = 0;

int pageSize = 500;

CampaignPage page = new CampaignPage();

try

{

do

{

selector.paging.startIndex = offset;

selector.paging.numberResults = pageSize;

// Get the campaigns.

page = campaignService.get(selector);

Console.WriteLine(page.totalNumEntries.ToString());

// Display the results.

if (page != null && page.entries != null)

{

int i = offset;

foreach (Campaign campaign in page.entries)

{

Console.WriteLine("{0}) Campaign with id = '{1}', name = '{2}' " +

" was found.", i + 1, campaign.id, campaign.name, campaign.status);

i++;

}

}

offset += pageSize;

} while (offset < page.totalNumEntries);

Console.WriteLine("Number of campaigns found: {0}", page.totalNumEntries);

}

catch (Exception ex)

{

Console.WriteLine( "Failed to retrieve campaigns"+ ex.Message.ToString() );

}

Anthony Madrigal

unread,
Oct 15, 2015, 12:15:16 PM10/15/15
to AdWords API Forum
Hi,

Could you please reply privately to author me with your Client Customer Id so that I could take a look to see what may be going wrong?

Thanks,
Anthony
AdWords API Team

Senthil Palaniswami

unread,
Oct 15, 2015, 12:17:26 PM10/15/15
to adwordsapiadvi...@google.com, AdWords API Forum
thanks Anthony. I just sent ..

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/IxqH423lPJY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/db54c89a-de38-46a5-bd46-551eba706027%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Anthony Madrigal

unread,
Oct 15, 2015, 12:22:33 PM10/15/15
to AdWords API Forum
Hi Senthil,

Thanks for providing me your CID! The reason your API call is not returning any campaigns is because the CID you are using is an MCC account. You will need to modify your clientCustomerId to an ID of one your client accounts. Once you do so, you will get back all campaigns associated to that account. 

Cheers,
Anthony
AdWords API Team

Senthil Palaniswami

unread,
Oct 15, 2015, 1:28:10 PM10/15/15
to adwordsapiadvi...@google.com, AdWords API Forum
Awesome .. thanks ..

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and Google+:
https://googleadsdeveloper.blogspot.com/
https://plus.google.com/+GoogleAdsDevelopers/posts
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to a topic in the Google Groups "AdWords API Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/adwords-api/IxqH423lPJY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to adwords-api...@googlegroups.com.
Visit this group at http://groups.google.com/group/adwords-api.
Reply all
Reply to author
Forward
0 new messages