Hi, Could you elaborate on why you are not using the reporting utility in the .NET client library <https://github.com/googleads/googleads-dotnet-lib>, as shown in the DownloadCriteriaReport example <https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/v201603/Reporting/DownloadCriteriaReport.cs>? That will handle setting all of the necessary headers, etc. All you have to do is configure your *App.config* file as specified in the App.config sample in the library <https://github.com/googleads/googleads-dotnet-lib/blob/master/examples/AdWords/CSharp/App.config>, and the library will take care of exchanging your refresh token for an access token, as well as properly setting up the HTTP request for reports.
Thanks, Josh, AdWords API Team On Friday, April 29, 2016 at 9:05:55 AM UTC-4, [email protected] wrote: > > I keep getting this error > "<?xml version=\"1.0\" encoding=\"UTF-8\" > standalone=\"yes\"?><reportDownloadError><ApiError><type>AuthenticationError.NOT_ADS_USER</type><trigger><null></trigger><fieldPath></fieldPath></ApiError></reportDownloadError>" > > I know this error means: > Reason*NOT_ADS_USER*SummaryThe login used to generate the access token is > not associated with any AdWords account.Common causesThe login > information provided corresponds to a Google account that does not have > AdWords enabled. > The problem is that* I am able to use these same credentials in the C# > sample asp.net <http://asp.net> application and get authenticated. * > > Why would these credentials work in one instance but not this instance? > > Here is my code: > > using RestSharp; > using System; > using System.Collections.Generic; > using System.Linq; > using System.Text; > using System.Threading.Tasks; > > namespace GoogleAdWordsReportPuller > { > class FileGrabber > { > > string reportDefinition = @"<reportDefinition xmlns="" > https://adwords.google.com/api/adwords/cm/v201603""> > <selector> > <fields>AdGroupName</fields> > <fields>Date</fields> > <fields>AdGroupStatus</fields> > <fields>CampaignName</fields> > <fields>Impressions</fields> > <fields>Clicks</fields> > <fields>Conversions</fields> > <fields>Cost</fields> > </selector> > <reportName>Custom Adgroup Performance Report</reportName> > <reportType>ADGROUP_PERFORMANCE_REPORT</reportType> > <dateRangeType>YESTERDAY</dateRangeType> > <downloadFormat>CSV</downloadFormat> > </reportDefinition>"; > > > string developerToken = "xxxxxxxxxxxxx"; > string clientId = " > xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com"; > string accessToken = > "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; // actually a > refresh token > > > string accountId = "585-353-4323"; // client account id > > string clientUrl = " > https://adwords.google.com/api/adwords/reportdownload/v201603"; > > > public void GetReport() > { > > //Host: adwords.google.com > //User-Agent: curl, gzip > //Accept: */* > //Accept-Encoding: gzip > //Authorization: Bearer [Enter OAuth 2.0 access token here] > //developerToken: [Enter developerToken here] > //clientCustomerId: [Enter clientCustomerID here] > //Content-Length: 784 > //Expect: 100-continue > //Content-Type: multipart/form-data; > boundary=------------------------12d01fae60c7b559 > > var client = new RestClient(clientUrl); > var request = new RestRequest(Method.POST); > > // set http headers > request.AddHeader("Host", "adwords.google.com"); > request.AddHeader("User-Agent", "curl, gzip"); > request.AddHeader("Accept", "*/*"); > request.AddHeader("Accept-Encoding", "gzip"); > request.AddHeader("Authorization", accessToken); // tried > request.AddHeader("Authorization", "Bearer " + accessToken); > request.AddHeader("developerToken", developerToken); > request.AddHeader("clientCustomerId", accountId); > request.AddHeader("Content-Length", "784"); > //request.AddHeader("Expect", "100-continue"); > request.AddHeader("Content-Type", "multipart/form-data; > boundary=------------------------12d01fae60c7b559"); > > //set request parameters > request.AddParameter("__rdxml", reportDefinition); // adds to > POST or URL querystring based on Method > > // execute the request > IRestResponse response = client.Execute(request); > var content = response.Content; // raw content as string > > } > > } > } > > > > I'm wondering if I need an access token instead because according to the > documentation: > https://developers.google.com/adwords/api/docs/guides/reporting#complete-example > The http header has a field that says: > > POST /api/adwords/reportdownload/v201601 HTTP/1.1 > Host: adwords.google.com > User-Agent: curl, gzip > Accept: */* > Accept-Encoding: gzip > Authorization: Bearer [Enter OAuth 2.0 access token here] > developerToken: [Enter developerToken here] > clientCustomerId: [Enter clientCustomerID here] > Content-Length: 784 > Expect: 100-continue > Content-Type: multipart/form-data; > boundary=------------------------12d01fae60c7b559 > > > Can anyone help me? > > 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 [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]. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/3683077f-0339-4248-a136-226332b5f479%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
