Salem,

If you are using a MCC's login to retrieve a refresh token, then you should 
be able to re-use the same refresh token to exchange for access tokens w/o 
having to re-authorize / go through consent screen again.

Unfortunately, without an understanding of your application, it would be 
difficult to advise you on what you are experiencing.  For example, you may 
need to keep the refresh token stored securely, and your application should 
refer to it every time you need to retrieve a report.

Thanks,

Ray

On Thursday, March 20, 2014 1:03:14 PM UTC-4, Ray Tsang (AdWords API Team) 
wrote:
>
> Salem,
>
> You'll need to use the customer ID for each customer you get and get the 
> report for each of those customers.  You can set the customer ID 
> dynamically in the code.
>
> Thanks,
>
> On Thursday, March 20, 2014 11:03:15 AM UTC-4, Salem Hassan wrote:
>>
>> Hi Ray,
>>
>> I need to get the Account performance report at the MCC level (for all 
>> the accounts under my MCC).
>> Can you advise which Report should be used then..?
>> I could get the details like Login, CustomerId, and Name at MCC level by 
>> referring the 'GetAccountHierercy.cs' in the sample solution.
>> But i need more details like Clicks, Cost per Click etc which are not 
>> available with it.
>>
>> Thanks
>>
>>
>>
>>
>> On Monday, March 17, 2014 7:47:53 PM UTC+5:30, Salem Hassan wrote:
>>>
>>>
>>> I'm using  OAuth 2.0 Authentication for Adwords API.
>>>
>>> I'm running the  'awapi_dotnet_lib_v16.7.0' sample solution (.NET 
>>> Library)  from google and in the 'AdWords.Examples.CSharp' I have the 
>>> following tags set in my app.config file:
>>>
>>>     <add key="UserAgent" value="xxxxxxxxxxxxxxx"/>
>>>     <add key="DeveloperToken" value="xxxxxxxxxxxxxxxxxxx"/>
>>>     <add key="ClientCustomerId" value="xxx-xxx-xxxx"/>
>>>     <add key="AuthorizationMethod" value="OAuth2" />
>>>     <add key="OAuth2ClientId" 
>>> value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
>>>     <add key="OAuth2ClientSecret" value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxx" 
>>> />
>>>     <add key="OAuth2Mode" value="APPLICATION" />
>>>     <add key="OAuth2RefreshToken" 
>>> value="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" />
>>>
>>> I'm able to run the 'GetAccountHierarchy' functionality through command 
>>> line (v201402.GetAccountHierarchy) to fetch all the accounts under my MCC 
>>> (client centre).
>>> But, when I tries to run the DownloadCriteriaReport 
>>>  (v201402.DownloadCriteriaReport) to fetch Account Performance Report it 
>>> gives me error..
>>>
>>> *Message*: Report download errors occurred, see errors field for more 
>>> details.
>>>
>>> *Source*: Google.AdWords
>>>
>>> *Stack Trace*:   
>>>
>>>  at 
>>> Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadReportToStream(String
>>>  
>>> downloadUrl, Boolean returnMoneyInMicros, String postBody, Stream 
>>> outputStream) in c:\src\MyProjects\now\Common library 
>>> base\adwords\compile\Util\Reports\ReportUtilities.cs:line 304
>>>    at 
>>> Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadClientReportInternal(String
>>>  
>>> downloadUrl, String postBody, Boolean returnMoneyInMicros, String path) in 
>>> c:\src\MyProjects\now\Common library 
>>> base\adwords\compile\Util\Reports\ReportUtilities.cs:line 253
>>>    at 
>>> Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadClientReport[T](T
>>>  
>>> reportDefinition, Boolean returnMoneyInMicros, String path) in 
>>> c:\src\MyProjects\now\Common library 
>>> base\adwords\compile\Util\Reports\ReportUtilities.cs:line 215
>>>    at 
>>> Google.Api.Ads.AdWords.Util.Reports.ReportUtilities.DownloadClientReport[T](T
>>>  
>>> reportDefinition, String path) in c:\src\MyProjects\now\Common library 
>>> base\adwords\compile\Util\Reports\ReportUtilities.cs:line 195
>>>    at 
>>> Google.Api.Ads.AdWords.Examples.CSharp.v201402.DownloadCriteriaReport.Run(AdWordsUser
>>>  
>>> user, String fileName) in 
>>> C:\Users\BGS002\Downloads\awapi_dotnet_lib_v16.7.0\examples\csharp\v201402\Reporting\DownloadCriteriaReport.cs:line
>>>  
>>> 112
>>>
>>> Here is the image : 
>>>
>>>
>>> <https://lh5.googleusercontent.com/-Q510gf82WMY/UycB7OqdhFI/AAAAAAAAABA/lOf-crSIpMU/s1600/error.JPG>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Here is the code:
>>>
>>>  public void Run(AdWordsUser user, string fileName) {
>>>       ReportDefinition definition = new ReportDefinition();
>>>       definition.reportName = "Custom ACCOUNT_PERFORMANCE_REPORT";
>>>       definition.reportType = 
>>> ReportDefinitionReportType.ACCOUNT_PERFORMANCE_REPORT;
>>>       definition.downloadFormat = DownloadFormat.CSV;
>>>       definition.dateRangeType = ReportDefinitionDateRangeType.TODAY;
>>>     
>>>       // Create selector.
>>>       Selector selector = new Selector();
>>>       selector.fields = new string[] {"AdGroupId", "AdGroupName", 
>>> "Clicks", "Impressions"};
>>>
>>>       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 = ExampleUtilities.GetHomeDir() + 
>>> Path.DirectorySeparatorChar + fileName;
>>>       try {
>>>         ReportUtilities utilities = new ReportUtilities(user);
>>>         utilities.ReportVersion = "v201402";
>>>         
>>>         utilities.DownloadClientReport(definition, filePath);
>>>         Console.WriteLine("Report was downloaded to '{0}'.", filePath);
>>>       } catch (Exception ex) {
>>>         throw new System.ApplicationException("Failed to download 
>>> report.", ex);
>>>       }
>>>     }
>>>
>>>
>>> I have also tried this on the web example with this code:
>>>
>>> protected void OnDownloadReportButtonClick(object sender, EventArgs e) {
>>>       ConfigureUserForOAuth();
>>>       ReportDefinition definition = new ReportDefinition();
>>>       string fileName = "GoogleAdwords.csv";
>>>       definition.reportName = "Custom ACCOUNT_PERFORMANCE_REPORT";
>>>       definition.reportType = 
>>> ReportDefinitionReportType.ACCOUNT_PERFORMANCE_REPORT;
>>>       definition.downloadFormat = DownloadFormat.CSV;
>>>       definition.dateRangeType = ReportDefinitionDateRangeType.TODAY;
>>>       // Create selector.
>>>       Selector selector = new Selector();
>>>       selector.fields = new string[] {"AccountId"};
>>>       definition.selector = selector;
>>>       string filePath = "D:\\Adwords" + Path.DirectorySeparatorChar + 
>>> fileName;
>>>       (user.Config as AdWordsAppConfig).OAuth2RefreshToken = 
>>> xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
>>>       try {
>>>         // If you know that your report is small enough to fit in 
>>> memory, then
>>>         // you can instead use
>>>           ReportUtilities utilities = new ReportUtilities(user);
>>>           utilities.ReportVersion = "v201402";
>>>           ClientReport report = utilities.GetClientReport(definition);
>>>         //
>>>         // // Get the text report directly if you requested a text format
>>>         // // (e.g. xml)
>>>          string reportText = report.Text;
>>>         //
>>>         // // Get the binary report if you requested a binary format
>>>         // // (e.g. gzip)
>>>          byte[] reportBytes = report.Contents;
>>>         //
>>>         // // Deflate a zipped binary report for further processing.
>>>         string deflatedReportText = Encoding.UTF8.GetString(
>>>            MediaUtilities.DeflateGZipData(report.Contents));
>>>         utilities.DownloadClientReport(definition, filePath);
>>>       } catch (Exception ex) {
>>>         throw new System.ApplicationException("Failed to download 
>>> report.", ex);
>>>       }
>>>       Response.AddHeader("content-disposition", 
>>> "attachment;filename=report.csv");
>>>       Response.WriteFile(filePath);
>>>       Response.End();
>>>     }
>>>
>>> But was getting the following error  :  Adwords Error - 
>>> Web<https://s3.amazonaws.com/uploads.hipchat.com/36514/402858/ppgl3NxEqWxWiy9/AdwordsError.txt>
>>>
>>> Please note that i have all settings in my web.config file and was able 
>>> to authenticate and also run the 'Get Campaigns' Functionality  from the 
>>> .Net Example by giving a Customer Id.
>>> The issue is while trying to download the Account Performance Report...
>>>
>>> What am I doing wrong in my code...?
>>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [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
--- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to