Campaign + Adwords + Keywords Details are not coming

50 views
Skip to first unread message

Sahdev

unread,
Jul 5, 2011, 2:43:10 AM7/5/11
to AdWords API Forum
Hey group,

I could able to get account details using
(ServicedAccountService)user.GetService(AdWordsService.v201101.ServicedAccountService);

but i'm unable to get details of followings:

AdGroupService adGroupService =
(AdGroupService)user.GetService(AdWordsService.v201101.AdGroupService);
--> GetAllAds.cs
CampaignService campaignService =(CampaignService)user.
GetService(AdWordsService.v201101.CampaignService);-->
GetAllCampaigns.cs

could you please help to identify what i'm missing from attached file?

code snip-shot :

// Get the AdGroupAdService.
AdGroupService adGroupService =
(AdGroupService)user.GetService(AdWordsService.v201101.AdGroupService);

long campaignId = long.Parse(("66098546"));

// Create a selector and set the filters.
Selector selector = new Selector();

// Set the fields to select.
selector.fields = new string[] { "Id", "Name" };

// Set a filter condition.
Predicate predicate = new Predicate();
predicate.field = "CampaignId";
predicate.@operator = PredicateOperator.EQUALS;
predicate.values = new string[] { campaignId.ToString() };

selector.predicates = new Predicate[] { predicate };
string getDetails = null;
try
{
AdGroupPage page = adGroupService.get(selector);

if (page != null && page.entries != null)
{
foreach (AdGroup adGroup in page.entries)
{
getDetails += "Ad id is {0} and status is {1}
<br>" + adGroup.name + "<br>" + adGroup.id + "<hr>";
}
}
else
{
getDetails += "Nothing found";
}
}
catch (Exception ex)
{
getDetails += "Failed to get Ad(s). Exception says
\"{0}\"<br>" + ex.Source + "<br>" + ex.InnerException +"<br>"+ ex.Data
+"<br>"+ ex.HelpLink;
}

Anash P. Oommen

unread,
Jul 8, 2011, 2:15:08 AM7/8/11
to adwor...@googlegroups.com
Hi Sahdev,

I can think of 2 possible reasons:

1. The campaign id is wrong.
2. The clientEmail/clientCustomerId set on the user object doesn't own the campaignId you are providing.

Could you confirm if these details are correct at your end? Let me know if you have more questions.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Sahdev

unread,
Aug 3, 2011, 10:13:19 PM8/3/11
to AdWords API Forum, Anash P. Oommen
Hi Anash,

Details are correct, I could able to get the details of
"ServicedAccountService", following code is working fine, I'm able to
see the account details

Problem is only with Campaign + Keywords etc.,

ServicedAccountService servicedAccountService =
(ServicedAccountService)user.GetService(AdWordsService.v201101.ServicedAccountService);
string AcountDetailsQuery = null;
ServicedAccountSelector selector = new
ServicedAccountSelector();
selector.serviceTypes = new ServiceType[]
{ ServiceType.UI_AND_API, ServiceType.API_ONLY };
selector.enablePaging = false;

try
{
ServicedAccountGraph graph =
servicedAccountService.get(selector);

if (graph != null && graph.accounts != null)
{
// Display the accounts.
//AcountDetailsQuery += "There are {0} customers
under this account hierarchy." + graph.accounts.Length;
for (int i = 0; i < graph.accounts.Length; i++)
{
AcountDetailsQuery +=
graph.accounts[i].customerId + "<br>" + graph.accounts[i].login +
"<br>" + graph.accounts[i].companyName + "<br>" +
graph.accounts[i].canManageClients + "<hr>";


}

// Display the links.
foreach (Link link in graph.links)
{
AcountDetailsQuery += "LINKS" +
link.typeOfLink + "<br>" + link.serviceType + "<br>" +
link.managerId.id + "<br>" + link.clientId.id + "<hr>";
}
}

}
catch (Exception ex)
{
AcountDetailsQuery += "Failed to retrieve accounts.
Exception says \"{0}\"" + ex.Message;
}
return AcountDetailsQuery;




On Jul 8, 11:15 am, "Anash P. Oommen" <anash.p...@google.com>
wrote:
Reply all
Reply to author
Forward
0 new messages