Hi,

I am downloading daily reports so I can generate stats for client. I am 
having issues with using "DURING" for "CALL_METRICS_CALL_DETAILS_REPORT" 
report.

Here is my PHP code:

// define date range
$dateRange = sprintf('%d,%d', date('Ymd'), date('Ymd'));

// generate query
$reportQuery = 'SELECT CampaignId, CallDuration, CallEndTime, 
CallStartTime, CallStatus, CallType FROM CALL_METRICS_CALL_DETAILS_REPORT 
WHERE CampaignId IN [' . implode(",", $settings['campaigns']) . '] DURING ' 
. $dateRange;

// Set additional options.
$options = array('version' => ADWORDS_VERSION);

// Download report
try {
$report = ReportUtils::DownloadReportWithAwql($reportQuery, NULL, $user, 
'XML', $options);

print_r($report); die();

} catch (Exception $e) {

print_r($e); die();

}

As result I am getting exception:

ReportDownloadException Object
(
    [message:protected] => Report download failed. Underlying errors are 
Type = 'QueryError.INVALID_DURING_CLAUSE', Trigger = '', FieldPath = ''. 
    [string:Exception:private] => 
    [code:protected] => 400
    [file:protected] => 
/var/www/adwordsdashboard/protected/components/Google/Api/Ads/AdWords/Util/ReportUtils.php
    [line:protected] => 194
    [trace:Exception:private] => Array
        (
            [0] => Array
                (
                    [file] => 
/var/www/adwordsdashboard/protected/components/Google/Api/Ads/AdWords/Util/ReportUtils.php
                    [line] => 123
                    [function] => DownloadReportFromUrl
                    [class] => ReportUtils
                    [type] => ::
                    [args] => Array
                        (
                            [0] => 
https://adwords.google.com/api/adwords/reportdownload/v201402
                            [1] => Array
                                (
                                    [Authorization] => Bearer (...HIDDEN...)
                                    [developerToken] => (...HIDDEN...)
                                    [clientCustomerId] => (...HIDDEN...)
                                )

                            [2] => Array
                                (
                                    [__rdquery] => SELECT CampaignId, 
CallDuration, CallEndTime, CallStartTime, CallStatus, CallType FROM 
CALL_METRICS_CALL_DETAILS_REPORT WHERE CampaignId IN [141621901,141684541] 
DURING 20140512,20140512
                                    [__fmt] => XML
                                )

                            [3] => 
                        )

                )

            [1] => Array
                (
                    [file] => 
/var/www/adwordsdashboard/protected/commands/CronCommand.php
                    [line] => 135
                    [function] => DownloadReportWithAwql
                    [class] => ReportUtils
                    [type] => ::
                    [args] => Array
                        (
                            [0] => SELECT CampaignId, CallDuration, 
CallEndTime, CallStartTime, CallStatus, CallType FROM 
CALL_METRICS_CALL_DETAILS_REPORT WHERE CampaignId IN [141621901,141684541] 
DURING 20140512,20140512
                            [1] => 
                            [2] => AdWordsUser Object
                                (
                                    [libVersion:AdWordsUser:private] => 
5.2.1
                                    [libName:AdWordsUser:private] => 
AwApi-PHP
                                    [defaultVersion:AdWordsUser:private] => 
v201402
                                    [defaultServer:AdWordsUser:private] => 
https://adwords.google.com
                                    [email:AdWordsUser:private] => 
                                    [password:AdWordsUser:private] => 
                                    [userAgent:AdWordsUser:private] => 
AdWords Dashboard
                                    [requestHeaderElements:AdsUser:private] 
=> Array
                                        (
                                            [authToken] => 
                                            [userAgent] => AdWords 
Dashboard (AwApi-PHP/5.2.1, Common-PHP/5.2.1, PHP/5.4.9-4ubuntu2.4)
                                            [clientCustomerId] => 
(...HIDDEN...)
                                            [developerToken] => 
(...HIDDEN...)
                                            [applicationToken] => 
                                        )

                                    [logsDirectory:AdsUser:private] => 
/var/www/adwordsdashboard
                                    [soapCompression:AdsUser:private] => 1
                                    [soapCompressionLevel:AdsUser:private] 
=> 1
                                    [wsdlCache:AdsUser:private] => 0
                                    [authServer:AdsUser:private] => 
https://accounts.google.com
                                    [oauth2Info:AdsUser:private] => Array
                                        (
                                            [client_id] => (...HIDDEN...)
                                            [client_secret] => 
(...HIDDEN...)
                                            [refresh_token] => 
(...HIDDEN...)
                                            [access_token] => (...HIDDEN...)
                                            [token_type] => Bearer
                                            [expires_in] => 3600
                                            [timestamp] => 1399885836
                                        )

                                    [oauth2Handler:AdsUser:private] => 
SimpleOAuth2Handler Object
                                        (
                                            
[curlUtils:SimpleOAuth2Handler:private] => CurlUtils Object
                                                (
                                                )

                                            [server:OAuth2Handler:private] 
=> https://accounts.google.com
                                            [scope:protected] => 
https://adwords.google.com/api/adwords/
                                        )

                                    [libVersion:AdsUser:private] => 5.2.1
                                    [libName:AdsUser:private] => Common-PHP
                                    [defaultServer:AdsUser:private] => 
https://adwords.google.com
                                    [defaultVersion:AdsUser:private] => 
v201402
                                )

                            [3] => XML
                            [4] => Array
                                (
                                    [version] => v201402
                                )

                        )

                )

            [2] => Array
                (
                    [file] => 
/var/www/adwordsdashboard/framework/console/CConsoleCommandRunner.php
                    [line] => 71
                    [function] => run
                    [class] => CronCommand
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                )

                        )

                )

            [3] => Array
                (
                    [file] => 
/var/www/adwordsdashboard/framework/console/CConsoleApplication.php
                    [line] => 92
                    [function] => run
                    [class] => CConsoleCommandRunner
                    [type] => ->
                    [args] => Array
                        (
                            [0] => Array
                                (
                                    [0] => ./protected/yiic
                                    [1] => cron
                                )

                        )

                )

            [4] => Array
                (
                    [file] => 
/var/www/adwordsdashboard/framework/base/CApplication.php
                    [line] => 180
                    [function] => processRequest
                    [class] => CConsoleApplication
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [5] => Array
                (
                    [file] => /var/www/adwordsdashboard/framework/yiic.php
                    [line] => 33
                    [function] => run
                    [class] => CApplication
                    [type] => ->
                    [args] => Array
                        (
                        )

                )

            [6] => Array
                (
                    [file] => /var/www/adwordsdashboard/protected/yiic.php
                    [line] => 7
                    [args] => Array
                        (
                            [0] => 
/var/www/adwordsdashboard/framework/yiic.php
                        )

                    [function] => require_once
                )

            [7] => Array
                (
                    [file] => /var/www/adwordsdashboard/protected/yiic
                    [line] => 4
                    [args] => Array
                        (
                            [0] => 
/var/www/adwordsdashboard/protected/yiic.php
                        )

                    [function] => require_once
                )

        )

    [previous:Exception:private] => 
)

But, if I remove "DURING" from query and make it like this:
$reportQuery = 'SELECT CampaignId, CallDuration, CallEndTime, 
CallStartTime, CallStatus, CallType FROM CALL_METRICS_CALL_DETAILS_REPORT 
WHERE CampaignId IN [' . implode(",", $settings['campaigns']) . ']';
Query will return data.

By this doc: https://developers.google.com/adwords/api/docs/guides/awql 
DURING is optional in service calls but required in report downloads, so I 
confused, what I am doing wrong?

Please note that in same function I am downloading one more report 
(CRITERIA_PERFORMANCE_REPORT), before this one, which have the same DURING 
and that one is working just fine.

Thank you,

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 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
--- 
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 adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to