QueryError.INVALID_DURING_CLAUSE For CALL_METRICS_CALL_DETAILS_REPORT

671 views
Skip to first unread message

Boris Savic

unread,
May 12, 2014, 5:43:15 AM5/12/14
to adwor...@googlegroups.com
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,

Anash P. Oommen (AdWords API Team)

unread,
May 12, 2014, 1:53:47 PM5/12/14
to adwor...@googlegroups.com
Hi Boric,

CALL_METRICS_CALL_DETAILS_REPORT supports only data for a single day, so the DURING clause isn't supported for this report type.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Boris Savic

unread,
May 13, 2014, 3:00:40 AM5/13/14
to adwor...@googlegroups.com
So how can I get this report just for today?

Anash P. Oommen (AdWords API Team)

unread,
May 15, 2014, 11:37:26 AM5/15/14
to adwor...@googlegroups.com
Hi Boric,

You don't need to specify the date clause for this report. That said, let me check once with the team whether date columns were intentionally excluded from this report type.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Biniam Asnake

unread,
Mar 14, 2018, 5:41:39 AM3/14/18
to AdWords API Forum
Any update on this since I am having a similar problem.

Anash P. Oommen (AdWords API Team)

unread,
Mar 20, 2018, 8:22:39 AM3/20/18
to AdWords API Forum
Hi Biniam,

This thread is really old, could you start a new thread please?

Cheers
Anash P. Oommen,
AdWords API Advisor.

Reply all
Reply to author
Forward
0 new messages