Customer can not create report of a selected type.. (Error: ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH, FieldPath: selector.reportDefinition, Trigger: )

468 views
Skip to first unread message

Vinayaka N

unread,
Feb 15, 2017, 9:58:03 AM2/15/17
to AdWords API Forum
I have written code for getting reports, but I am getting exception   Customer can not create report of a selected type.. (Error: ReportDefinitionError.CUSTOMER_SERVING_TYPE_REPORT_MISMATCH, FieldPath: selector.reportDefinition, Trigger: ). 

code is below

 ReportDefinition definition = new ReportDefinition()
            {
                reportName = "Last 7 days CRITERIA_PERFORMANCE_REPORT",
                reportType = ReportDefinitionReportType.CRITERIA_PERFORMANCE_REPORT,
                downloadFormat = DownloadFormat.XML,
                dateRangeType = ReportDefinitionDateRangeType.LAST_7_DAYS,

                selector = new Selector()
                {
                    fields = new string[] 
                    {"CampaignId", "AdGroupId", "Id", "CriteriaType", "Criteria",
                        "FinalUrls", "Clicks", "Impressions", "Cost"
                    },
                    predicates = new Predicate[] 
                    {
                        Predicate.In("Status", new string[] {"ENABLED", "PAUSED"})
                    }
                },
            };

            (user.Config as AdWordsAppConfig).IncludeZeroImpressions = true;

            string filepath = Server.MapPath("data.xml");
            try
            {
                ReportUtilities utilities = new ReportUtilities(user,"v201609",definition);
                using (ReportResponse response = utilities.GetResponse())
                {
                    response.Save(filepath);
                }
                Response.Write("Report downloaded"+ filepath);
            }
            catch(Exception ex)
            {
                string a = ex.Message;
            }


I am not able to understand where I am going wrong please help me.

Any help appreciated.

Shwetha Vastrad (AdWords API Team)

unread,
Feb 15, 2017, 12:08:51 PM2/15/17
to AdWords API Forum
Hi Vinayaka,

It looks like you are trying to download a report from a manager account. AdWords API reports can only be obtained for client (non-manager) accounts. You can use ManagedCustomerService to get account information, and if ManagedCustomer.canManageClients is true, then the account is a manager account. This way you can ensure that the clientCustomerId in the reporting request corresponds to a non-manager account. 

Regards,
Shwetha, AdWords API Team.
Reply all
Reply to author
Forward
0 new messages