ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector in MCC Account
Good morning for all, I did the following code: getReportFields($reportType); $fieldsBlockeds = array( 'ConversionCategoryName', 'ConversionTypeName', 'ClickType', 'BudgetLostImpressionShare', 'Device', 'ExactMatchImpressionShare', 'HourOfDay', 'ImpressionShare', 'QualityLostImpressionShare' ); $fields = array(); foreach($reportDefinitionFields as $field) if(!in_array($field->fieldName,$fieldsBlockeds)) $fields[] = $field->fieldName; $selector = new Selector(); $selector->fields = $fields; $reportDefinition = new ReportDefinition(); $reportDefinition->reportName = $reportType . ' ' . time(); $reportDefinition->dateRangeType = 'LAST_7_DAYS'; $reportDefinition->reportType = $reportType; $reportDefinition->downloadFormat = 'XML'; $reportDefinition->selector = $selector; return (object) $reportDefinition; } private function getAllReportDefinition(ReportDefinitionService $reportDefinitionService){ // Create selector. $selector = new ReportDefinitionSelector(); // Get all report definitions. $page = $reportDefinitionService->get($selector); // Display report definitions. if (isset($page->entries)) { foreach ($page->entries as $reportDefinition) { printf("ReportDefinition with name '%s' and id '%s' was found.\n ", $reportDefinition->reportName, $reportDefinition->id); } } else { print "No report definitions were found.\n"; } } public function downloadReport($pathFileName,$reportDefinitionId){ ReportUtils::DownloadReport($reportDefinitionId, $pathFileName, $this->adwordsUser); } public function addReport($reportDefinition){ $operation = new ReportDefinitionOperation(); $operation->operand = $reportDefinition; $operation->operator = 'ADD'; $operations = array($operation); $result = $reportDefinitionService->mutate($operations); return $result; } public function removeReport($reportDefinitionId){ $reportDefinition = new ReportDefinition(); $reportDefinition->id = $reportDefinitionId; $operation = new ReportDefinitionOperation(); $operation->operand = $reportDefinition; $operation->operator = 'REMOVE'; $operations = array($operation); $result = $reportDefinitionService->mutate($operations); return $result; } public function __construct() { try { $email = 'email_cc_account_h...@gmail.com'; $pass = 'password'; $serviceVersion = 'v201101'; $userAgent = 'PHP Dynamo'; $developerToken = 'Djid_AAABBCCCDD'; //$developerToken = 'email_cc_account_h...@gmail.com++BRL'; $clientID = '000-000-'; //$clientID = 'client_1+email_cc_account_h...@gmail.com'; $serverData = 'https://adwords.google.com'; //$serverData = 'https://adwords-sandbox.google.com'; // Get AdWordsUser from credentials in "../auth.ini" // relative to the AdWordsUser.php file's directory. $this->adwordsUser = new AdWordsUser(null,$email,$pass, $developerToken,$userAgent,$clientID); // Log SOAP XML request and response. $this->adwordsUser->LogDefaults(); $reportDefinitionService = $this->adwordsUser- >GetReportDefinitionService($serviceVersion,$serverData); $reportDefinition = $this- >getReportDefinitionForAccountPerformanceReport($reportDefinitionService); $this->getAllReportDefinition($reportDefinitionService); $reportDefinitionId = (float) '143533360'; $pathFileName = APPLICATION_PATH . '/reportsDownloads/report'. $reportDefinitionId.'.xml'; $this->downloadReport($pathFileName,$reportDefinitionId); } catch (Exception $e) { echo $e->getMessage(); }
Re: ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector in MCC Account
Hi, It looks like you are hardcoding the report definition id after creating the definition for a new report. Are you sure that is a valid reportDefinitionId for the production environment? Report definitions cannot be shared between production and sandbox, so if that came from the sandbox it will not work. Based on your code, I would have expected you to save the report definition you are creating and then download based on that instead of hardcoding the ID. Try changing your code to do that. - Kevin Winter AdWords API Team -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
Re: ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector in MCC Account
Hi, I am storing report definition id to DB when add report definition. after that i try to download report. my code is : $user = new AdWordsUser(); $user->LogAll(); $reportDefinitionId = (float) '1.98675e+01'; $fileName = 'output_report.csv'; $path = dirname(__FILE__) . '/reports/' . $fileName; // Download report. ReportUtils::DownloadReport($reportDefinitionId, $path, $user); But i am getting error "ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector". Please note i have changed $reportDefinitionId for security. Thanks, Chirag On Aug 31, 12:23 am, Kevin Winter wrote: > Hi, > It looks like you are hardcoding the report definition id after creating > the definition for a new report. Are you sure that is a valid > reportDefinitionId for the production environment? Report definitions > cannot be shared between production and sandbox, so if that came from the > sandbox it will not work. > > Based on your code, I would have expected you to save the report definition > you are creating and then download based on that instead of hardcoding the > ID. Try changing your code to do that. > > - Kevin Winter > AdWords API Team -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
Re: ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector in MCC Account
Hi Chirag, Could you please double check that the ID you are using is not actually a float? Report Definition IDs should be of the form: 123456789 and should not have a decimal element or be used as floats. If you are still having problems troubleshooting, could you try defining a new report, providing me with the RequestId from the request that creates it, then try to download the report again? I can use this information to troubleshoot via our logs. - Kevin Winter AdWords API Team -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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
Re: ReportDefinitionError.INVALID_REPORT_DEFINITION_ID@selector.selector in MCC Account
Thanks Kevin, Yes, I am storing ID as float.I changed it to Int and now it is working fine. On Oct 12, 1:52 am, Kevin Winter wrote: > Hi Chirag, > Could you please double check that the ID you are using is not actually a > float? Report Definition IDs should be of the form: 123456789 and should > not have a decimal element or be used as floats. > > If you are still having problems troubleshooting, could you try defining a > new report, providing me with the RequestId from the request that creates > it, then try to download the report again? I can use this information to > troubleshoot via our logs. > > - Kevin Winter > AdWords API Team -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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