Hi Jeff,

The help you provided in the above reply was quite good. I am now just
trying to generate a report against a particular advertisement. I am
also pasting the code that i am using in generating a report against a
specific report. Can you just have a look at it and let me know that
if its correct? If there is something wrong can you guide me through
by writing some lines of correct code?

Also i have added my comments like ==> in the following code while
creating $report_job xml string.

I would also like to mention here that i am trying to show the advert
report for complete duration from the date it was created. And in
below code i have used some dumy dates.

=============================
$namespace = 'https://sandbox.google.com/api/adwords/v12';
                $report_service = SoapClientFactory::GetClient($namespace . '/
ReportService?wsdl', 'wsdl');
                $report_service->setHeaders($headers);
                $debug = 0;

                # Create report job structure.
                  $report_job =
                  '<selectedReportType>Creative</selectedReportType>' .
                  '<name>Sample Keyword Report</name>' .
                  '<aggregationTypes>Summary</aggregationTypes>' .
                  '<adWordsType>SearchOnly</adWordsType>' .
                  '<keywordType>Broad</keywordType>' .
                  '<startDay>2008-01-01</startDay>' .
                  '<endDay>2008-12-31</endDay>' .
                  '<selectedColumns AdId="127650">CreativeId</selectedColumns>' 
.
==> is this correct way of passing ad id?
                  '<selectedColumns 
CampaignId="1786">Campaign</selectedColumns>' .
==> is this correct way of passing campaign id?
                  '<selectedColumns AdGroupId="5000001207">AdGroup</
selectedColumns>' . ==> is this correct way of passing group id?
                  '<selectedColumns>Keyword</selectedColumns>' .
                  '<selectedColumns>KeywordStatus</selectedColumns>' .
                  '<selectedColumns>KeywordMinCPC</selectedColumns>' .
                  '<selectedColumns>KeywordDestUrlDisplay</selectedColumns>' .
                  '<selectedColumns>Impressions</selectedColumns>' .
                  '<selectedColumns>Clicks</selectedColumns>' .
                  '<selectedColumns>CTR</selectedColumns>' .
                  '<selectedColumns>AveragePosition</selectedColumns>';
                $request_xml =
                  '<validateReportJob>' .
                  '<job xmlns:impl="https://adwords.google.com/api/adwords/v12"; 
' .
                  'xsi:type="impl:DefinedReportJob">' .
                  $report_job .
                  '</job>' .
                  '</validateReportJob>';

                # Validate report.
                $report_service->call('validateReportJob', $request_xml);
                if ($debug) show_xml($report_service);
                if ($report_service->fault) show_fault($report_service);

                # Schedule report.
                $request_xml =
                  '<scheduleReportJob>' .
                  '<job xmlns:impl="https://adwords.google.com/api/adwords/v12"; 
' .
                  'xsi:type="impl:DefinedReportJob">' .
                  $report_job .
                  '</job>' .
                  '</scheduleReportJob>';
                $job_id = $report_service->call('scheduleReportJob', 
$request_xml);
                $job_id = $job_id['scheduleReportJobReturn'];
                if ($debug) show_xml($report_service);
                if ($report_service->fault) show_fault($service);

                # Wait for report to finish.
                $request_xml =
                  '<getReportJobStatus>' .
                  '<reportJobId>' .
                  $job_id .
                  '</reportJobId>' .
                  '</getReportJobStatus>';
                $status = $report_service->call('getReportJobStatus', 
$request_xml);
                $status = $status['getReportJobStatusReturn'];
                if ($debug) show_xml($report_service);
                if ($report_service->fault) show_fault($service);
                while ($status != 'Completed' and $status != 'Failed') {
                  //echo 'Report job status is "' . $status . '".' . "\n";
                  sleep(30);
                  $status = $report_service->call('getReportJobStatus',
$request_xml);
                  $status = $status['getReportJobStatusReturn'];
                  if ($debug) show_xml($report_service);
                  if ($report_service->fault) show_fault($service);
                }

                if ($status == 'Failed') {
                  echo 'Report job generation failed.' . "\n";
                  return;
                }

                # Download report.
                $request_xml =
                  '<getReportDownloadUrl>' .
                  '<reportJobId>' .
                  $job_id .
                  '</reportJobId>' .
                  '</getReportDownloadUrl>';
                $report_url = $report_service->call('getReportDownloadUrl',
$request_xml);
                $report_url = $report_url['getReportDownloadUrlReturn'];
                if ($debug) show_xml($report_service);
                if ($report_service->fault) show_fault($service);
=============================

Your quick response will be highly appriciated.

Regards,

Afzaal.

On Nov 7, 9:28 pm, AdWords API Advisor <[EMAIL PROTECTED]>
wrote:
> Hello Afzaal,
>
>  I think you really need to spend some time familiarizing yourself
> with AdWords reports in general. A good place to start would be to use
> the AdWords web interface to schedule some reports (which will not
> incur any usage fees) and find the right mix of columns and report
> types to get the data you're looking for. Once you have done that, you
> should be able to map the request you made in the AdWords web
> interface into a specific report definition in the AdWords API,
> starting with the selectedReportType:
>
>  http://code.google.com/apis/adwords/docs/developer/DefinedReportJob.h...
>
> and then choosing the corresponding selectedColumns.
>
>  If you schedule your report using the AdWords API from the context of
> your MCC account then you can run a cross-client report and get data
> from one or more of the AdWords accounts underneath the MCC at one
> time. See
>
>  http://code.google.com/apis/adwords/docs/developer/adwords_api_servic...
>
> Cheers,
> -Jeff Posnick, AdWords API Team
>
> On Nov 7, 9:52 am, Afzaal <[EMAIL PROTECTED]> wrote:
>
> > Hi Jeff,
>
> > Thanks for your reply.
>
> > Can you tell me that is there any possibility of the following:
>
> > 1. Can we get a report against a specific campaign?
>
> > 2. Can we get a report against a specific group?
>
> > 3. Can we get a report against a specific advertisement?
>
> > 4. Is the report generated is only for one google adword account?
>
> > 5. For multiple reports do we need multiple google adword accounts?
>
> > Regards,
>
> > Afzaal.
>
> > On Nov 6, 9:17 pm, AdWords API Advisor <[EMAIL PROTECTED]>
> > wrote:
>
> > > Hello Afzaal,
>
> > >  Once your report finishes and you retrieve its URL with
> > > getGzipReportDownloadUrl()/getReportDownloadUrl() you should retrieve
> > > the report using some sort of HTTP client library--shelling out to
> > > curl might be appropriate for the PHP use case. Once you retrieve the
> > > report you should store it locally and expose a link to the local copy
> > > of the report in your web interface.
>
> > >  It's tempting to just expose links to the URLs returned by
> > > getReportDownloadUrl() in your web interface, but those URLs are not
> > > valid indefinitely and will expire after a period of time, so you
> > > really should retrieve the report right away and serve it locally.
>
> > > Cheers,
> > > -Jeff Posnick, AdWords API Team
>
> > > On Nov 6, 1:51 am, Afzaal <[EMAIL PROTECTED]> wrote:
>
> > > > Hi Jeff,
>
> > > > Thanks for your reply and sorry for the last email by which you
> > > > couldn't get what i wanted to say. Ok here i am going to explain in a
> > > > bit detail what i am doing and what i further require.
>
> > > > I have already created Campaigns, Groups and Advertisements and all
> > > > these 3 scenarios are working fine. Now my client requires a
> > > > functionality that he can generate reports against different campaigns
> > > > for his customers. My client has further couple of customers and my
> > > > client wants that his customers can login to his website and see the
> > > > reports of the advertisements that they requested.
>
> > > > So i am trying to give facility to my client in website admin area
> > > > that he can add / schedule different reports. I have taken the help
> > > > from the code of report scheduling from the following link
>
> > > >http://code.google.com/p/adwords-api-php-samples/source/browse/trunk/...
>
> > > > By using this everything goes fine even i switch on the debug mode to
> > > > 1, no error is generated. So i just want an idea from you that if the
> > > > report is added successfully how i can show it on my client's website?
> > > > Is there any facility that instead of giving an instant download link
> > > > for the report i can give a reports management area to my client and
> > > > from there he can download any report previously added / scheduled?
>
> > > > I hope now you will get what i want, if still anything you further
> > > > require please let me know.
>
> > > > Thanks,
>
> > > > Regards,
>
> > > > Afzaal.
>
> > > > On Nov 5, 9:00 pm, AdWords API Advisor <[EMAIL PROTECTED]>
> > > > wrote:
>
> > > > > Hello Afzaal,
>
> > > > >  It's very unclear from what you wrote exactly what kind of guidance
> > > > > you're looking for. Could you please elaborate by explaining which
> > > > > specific AdWords API calls you're making, whether you're getting any
> > > > > errors back, and at what point in the report scheduling process you're
> > > > > running into an issue?
>
> > > > >  There is sample code for scheduling reports included with all of our
> > > > > AdWords API client libraries, I believe. The normal process involves:
>
> > > > >   - calling validateReportJob()
> > > > >   - calling scheduleReportJob()
> > > > >   - periodically calling getReportJobStatus() until the report
> > > > > finishes
> > > > >   - calling getGzipReportDownloadUrl()/getReportDownloadUrl() to get
> > > > > the URL of the report
> > > > >   - using some HTTP client library to download the report locally
>
> > > > > Cheers,
> > > > > -Jeff Posnick, AdWords API Team
>
> > > > > On Nov 5, 5:32 am, afzaal <[EMAIL PROTECTED]> wrote:
>
> > > > > > Hi Jeff,
>
> > > > > > I have some problem in report generation in google adwords. I have
> > > > > > designed the form according to the fields required for adding a
> > > > > > report, when i submit the data without any error the controlled is
> > > > > > returned to my page saying report was added successfully. But the 
> > > > > > area
> > > > > > where i am trying to view the added reports does not show me 
> > > > > > anything.
> > > > > > Can you please help me in this regard?
>
> > > > > > Can you elaborate the working of reports? I have read it on the site
> > > > > > but its not pretty clear to me. I will be thankful to you if you can
> > > > > > help me in this.
>
> > > > > > Regards,
>
> > > > > > Afzaal.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/adwords-api?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to