Re: Report Definition Clarification

2011-04-15 Thread Peter Stannett
Hi Eric

You are spot on. I was including the report number rather than the id. Silly 
boy!

Thanks again

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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: Report Definition Clarification

2011-04-14 Thread Eric Koleda
Hi Peter,

>From looking at the logs, it looks like the error you are getting is 
actually INVALID_REPORT_DEFINITION_ID.  Looking at your code, it doesn't 
look like you are using the returned report definition ID in your download 
request.

Best,
- Eric Koleda, 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: Report Definition Clarification

2011-04-14 Thread mm
That's the correct way to do it. I assume that with your original
definition you were setting min/max dates on the selector - be sure
those are removed.

HTH -
mm

On Apr 14, 4:25 am, Peter Stannett  wrote:
> Ok, Tried that and get IMPROPERLY_FORMATTED_REQUEST. If anyone else has any
> pointers I would be very grateful.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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: Report Definition Clarification

2011-04-14 Thread Peter Stannett
Hi and thanks for replying.

Hmm ...i think i have got them commented out. Perhaps you would oblige me by 
looking at my code?

Here is my AddAdgroupPerformanceReport.php

LogDefaults();

  // Get the GetReportDefinitionService.
  $reportDefinitionService = $user->GetReportDefinitionService('v201101');

  
 // $adGroupId = (float) '';
//$startDate = '';
//$endDate = '';

  // Create selector.
  $selector = new Selector();
  $selector->fields = array('Date','CampaignName', 'CampaignStatus', 
'AdGroupName', 'Status',  'Impressions', 'Clicks', 'Cost', 
'AveragePosition','ConversionsManyPerClick');
  //S$selector->dateRange = new DateRange($startDate, $endDate);

  // Create predicates.
  //$adGroupIdPredicate = new Predicate('AdGroupId', 'EQUALS', 
array($adGroupId));
  //$selector->predicates = array($adGroupIdPredicate);

  // Create report definition.
  $reportDefinition = new ReportDefinition();
  $reportDefinition->reportName = 'ADGROUP performance report #' . time();
  $reportDefinition->dateRangeType = 'YESTERDAY';
  $reportDefinition->reportType = 'ADGROUP_PERFORMANCE_REPORT';
  $reportDefinition->downloadFormat = 'CSV';
  $reportDefinition->selector = $selector;


  // Create operations.
  $operation = new ReportDefinitionOperation();
  $operation->operand = $reportDefinition;
  $operation->operator = 'ADD';

  $operations = array($operation);

  // Add report definition.
  $result = $reportDefinitionService->mutate($operations);

  // Display report definitions.
  if ($result != null) {
foreach ($result as $reportDefinition) {
  printf("Report definition with name '%s' and id '%s' was added.\n",
   $reportDefinition->reportName, $reportDefinition->id);   
   
$reportDefinitionId = $reportDefinition->id;
   $fileName = 'tv_g_ppc_data.csv';
$path = dirname(__FILE__) . '/data/' . $fileName;


  // Download report.
  ReportUtils::DownloadReport($reportDefinitionId, $path, $user);

  printf("Report with definition id '%s' was downloaded to '%s'.\n",
  $reportDefinitionId, $path, $fileName);


 } 
 
} 
  
 
 else {
print "No report definitions were added.\n";

  }
} catch (Exception $e) {
  print $e->getMessage();
}

  
This generated a report id of 1302769510

I entered this id into downloadreport.php

LogDefaults();

  $reportDefinitionId = '1302681607';
  $fileName = 'tv_g_ppc_data.csv';

  $path = dirname(__FILE__) . '/data/' . $fileName;

  // Download report.
  ReportUtils::DownloadReport($reportDefinitionId, $path, $user);

  printf("Report with definition id '%s' was downloaded to '%s'.\n",
  $reportDefinitionId, $path, $fileName);
} catch (Exception $e) {
  print $e->getMessage();
}

Not sure what I am doing wrong here? It's probably very simple!

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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: Report Definition Clarification

2011-04-14 Thread Peter Stannett
Ok, Tried that and get IMPROPERLY_FORMATTED_REQUEST. If anyone else has any 
pointers I would be very grateful.

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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: Report Definition Clarification

2011-04-13 Thread Peter Stannett
Ah thanks Pete I shall give that a try!

-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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: Report Definition Clarification

2011-04-12 Thread Pete Lavetsky (AdWords API Guru)
I haven't tried it yet, but I'm pretty sure it would be implemented
as:

ReportDefinition reportDefinition = new ReportDefinition();
reportDefinition.setDateRangeType( ReportDefinitionDateRangeType.YESTERDAY );

Then after you mutate the report ReportDefinitionOperation, keep the
reportId in your records and retrieve that reportId each day.

Haven't tried it yet, but that's what I'd try.

Pete

On Apr 12, 12:34 pm, Peter Stannett  wrote:
> Hi all
>
> I created a Adgroup Performance report to run daily for the previous day and
> this runs fine. Every day it creates a new Report Definition however I
> half-think I read that somewhere I can download a new instance of this
> report, rather than create a new Report. I would imagine this is a lot more
> cost effective.
>
> If this is the case, how would I implement this? If it isn't the case...then
> i will go back to sleep.
>
> Regards
> Peter

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