Hello All,

I am developing an application for my client where I need to run an AdWords 
report. I am newbie to this platform.

Here is what I have been provided with

1. An MCC account and a Developer Token
2. Client Id of MCC account
3. Login Id
4. Password

Here is what I am using:

1. ASP.NET Client Library version v201209
2. ClientLogin method

Here is what I am getting when invoking the method:

1. An Auth token by passing Email Id and Password
2. An exception 'UNABLE_TO_AUTHORIZE" where trying to get a report. This is 
my code snippet:

ReportDefinition definition = new ReportDefinition();
 
definition.reportName = "Last 7 days CRITERIA_PERFORMANCE_REPORT";
definition.reportType = ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT;
definition.downloadFormat = DownloadFormat.GZIPPED_CSV;
definition.dateRangeType = ReportDefinitionDateRangeType.LAST_7_DAYS;
 // Create selector.Selector selector = new Selector();
selector.fields = new string[] { "CampaignId", "AdGroupId", "Id", 
"CriteriaType", "Criteria", "CriteriaDestinationUrl", "Clicks", "Impressions", 
"Cost" };
 Predicate predicate = new Predicate();
predicate.field = "Status";
predicate.@operator = PredicateOperator.IN;
predicate.values = new string[] { "ACTIVE", "PAUSED" };
selector.predicates = new Predicate[] { predicate };
 
definition.selector = selector;
definition.includeZeroImpressions = true;


string filePath = fileName;

try
{
                ReportUtilities utilities = new ReportUtilities(user);
                utilities.ReportVersion = "v201209";
                ClientReport report = 
utilities.DownloadClientReport(definition, 
Server.MapPath("\\report\\report.xml"));
                Console.WriteLine("Report was downloaded to '{0}'.", filePath);
}catch (Exception ex)
{
                AuthorizationError err = new AuthorizationError();
                AuthorizationErrorReason reason = err.reason;
                string errDetail = err.ApiErrorType + ", " + err.errorString + 
", " + err.fieldPath + ", " + err.fieldPath;
                Response.Write(reason.ToString() + "<br />" + errDetail);
} 


I did not get much help about trouble shooting other than this (
https://developers.google.com/adwords/api/docs/troubleshooting#AuthorizationError
):

Reason
*    UNABLE_TO_AUTHORIZE*
Summary
*    There was an issue with completing authorization for a given 
user/account.*
Common causes
*    Attempting to create an account via ManagedCustomerService.mutate 
under a non-MCC account.*
Recommended handling tips
    *N/A*
Prevention tips
*    Use ManagedCustomerService to determine if the account is an MCC 
account. The field ManagedCustomer.canManageClients should be true.*

Google says "ManagedCustomerService" is a Read-only properly. But I could 
not find any such property called ManagedCustomerServic in the library.
Also I think it using the property will only prevent the error to come up?

I must be doing something wrong. Please help. I must get this working as 
soon as possible

Thanks in advance,

Subrata

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

--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to