Hello Team,
Please Help me to find the Client list for a particular google adwords
account.
As i am using the Google adwords api using version.
"AdWordsService.v201209" using the google adwords test account
To get the Client List I am using the Following Code.
(user.Config as AdWordsAppConfig).AuthorizationMethod =
AdWordsAuthorizationMethod.OAuth2;
OAuth2Provider oAuth2 = new OAuth2Provider(user.Config);
user.Config.OAuthConsumerKey =
"705284013785.apps.googleusercontent.com";
user.Config.OAuthConsumerSecret =
"wJaVUN26Ms5KYJgXY4zKZoXD";
oAuth2.AccessToken = Session["SecretGoogleadwords"] as
string;
oAuth2.RefreshToken = Session["Googleadwords"] as
string;
user.OAuthProvider = oAuth2;
(user.Config as AdWordsAppConfig).UserAgent =
"Webpresence";
(user.Config as AdWordsAppConfig).DeveloperToken =
"gopR7WQ1nGJAiqPgiyeqKQ";
(user.Config as AdWordsAppConfig).ClientCustomerId =
"773-963-1081";
(user.Config as AdWordsAppConfig).OAuth2AccessToken =
Session["SecretGoogleadwords"] as string;
(user.Config as AdWordsAppConfig).OAuth2RefreshToken =
Session["Googleadwords"] as string;
(user.Config as AdWordsAppConfig).AuthToken =
Session["SecretGoogleadwords"] as string;
ManagedCustomerService accountdetail =
(ManagedCustomerService)user.GetService(AdWordsService.v201209.ManagedCustomerService);
Selector SelectorDetail = new Selector();
SelectorDetail.fields = new string[] {
"name","currencyCode","dateTimeZone" };
ManagedCustomerPage paged3 = accountdetail.get(SelectorDetail);
if (paged3 != null && paged3.entries != null &&
paged3.entries.Length > 0)
{
DataTable dataTableaccount = new DataTable();
dataTableaccount.Columns.AddRange(new DataColumn[] {
new DataColumn("name", typeof(string)),
new DataColumn("customerId", typeof(string)),
new DataColumn("companyName", typeof(string)),
new DataColumn("currencyCode", typeof(string)),
new DataColumn("dateTimeZone.", typeof(string)),
});
for (int i = 0; i < paged3.entries.Length; i++)
{
ManagedCustomer ManagedCustomer = paged3.entries[i];
DataRow dataRow = dataTableaccount.NewRow();
dataRow.ItemArray = new object[] {i + 1,
ManagedCustomer.name, ManagedCustomer.customerId,
ManagedCustomer.companyName.ToString(),ManagedCustomer.currencyCode
};
dataTableaccount.Rows.Add(dataRow);
}
Please see the Above Code to get the Client List using the Google adwords
Api using the oauth2.0
Using above code Iam getting the Following Error:
Failed to get Accounts. Exception says "[SelectorError.INVALID_FIELD_NAME @
serviceSelector; trigger:'name', SelectorError.INVALID_FIELD_NAME @
serviceSelector; trigger:'currencyCode', SelectorError.INVALID_FIELD_NAME @
serviceSelector; trigger:'dateTimeZone']"
As if I have to get the Campaign using CampaignService to get the clicks
and impressions then
I am get the true result.
Please update me that Developer token ,CustomerId must me required for
this or not.
(user.Config as AdWordsAppConfig).DeveloperToken =
"gopR7WQ1nGJAiqPgiyeqKQ";
(user.Config as AdWordsAppConfig).ClientCustomerId =
"773-963-1081";
If I have not written this developer token and customerid for this then get
return the another error that is "Incomplete the Header Token Error"
Please update me to get the Client list using this Google Adwords Api.
If I uses same to get the Campaign list using CampaignService then I get
the correct result using the Developer Token and CustomerId. Also please
update me that these developer token and CustomerId will always required to
get the Campaign list using CampaignService
Thanks,
Arun Kumar
Smartdata Enterprises.
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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