AI-generated Key Takeaways
- 
          
The
Queryresource represents a single query used to generate a report and includes metadata, parameters, and schedule. - 
          
QueryMetadatacontains information about the query such as its title, data range, format, and notification settings. - 
          
DataRangedefines the date range for the report, which can be a preset range or custom dates. - 
          
QuerySchedulespecifies the frequency and duration for automated query runs. - 
          
Available methods for managing queries include creating, deleting, getting, listing, and running queries.
 
Resource: Query
A single query used to generate a report.
| JSON representation | 
|---|
{ "queryId": string, "metadata": { object (  | 
              
| Fields | |
|---|---|
queryId | 
                
                   
 Output only. The unique ID of the query.  | 
              
metadata | 
                
                   
 The metadata of the query.  | 
              
params | 
                
                   
 The parameters of the report generated by the query.  | 
              
schedule | 
                
                   
 When and how often the query is scheduled to run. If the   | 
              
QueryMetadata
The metadata of the query.
| JSON representation | 
|---|
{ "title": string, "dataRange": { object (  | 
              
| Fields | |
|---|---|
title | 
                
                   
 The display name of the query. This value will be used in the file name of reports generated by the query.  | 
              
dataRange | 
                
                   
 The date range the report generated by the query will report on. This date range will be defined by the time zone as used by the advertiser.  | 
              
format | 
                
                   
 The format of the report generated by the query.  | 
              
sendNotification | 
                
                   
 Whether an email notification is sent to the query creator when a report generated by the query is ready. This value is   | 
              
shareEmailAddress[] | 
                
                   
 List of additional email addresses with which to share the query. If  If these email addresses are connected to Display & Video 360 users, the query will be available to them in the Display & Video 360 interface.  | 
              
DataRange
The date range to be reported on.
| JSON representation | 
|---|
{ "range": enum (  | 
              
| Fields | |
|---|---|
range | 
                
                   
 The preset date range to be reported on. If   | 
              
customStartDate | 
                
                   
 If  This field is required if using   | 
              
customEndDate | 
                
                   
 If  This field is required if using   | 
              
Range
Available date ranges.
| Enums | |
|---|---|
RANGE_UNSPECIFIED | 
                Default value when range is not specified or is unknown in this version. | 
CUSTOM_DATES | 
                Custom date range. | 
CURRENT_DAY | 
                Current day. | 
PREVIOUS_DAY | 
                Previous day. | 
WEEK_TO_DATE | 
                All days, including the current day, since the most recent Sunday. | 
MONTH_TO_DATE | 
                All days, including the current day, since the start of the current month. | 
QUARTER_TO_DATE | 
                All days, including the current day, since the start of the current quarter. | 
YEAR_TO_DATE | 
                All days, including the current day, since the start of the current calendar year. | 
PREVIOUS_WEEK | 
                The previous completed week, beginning from Sunday. | 
PREVIOUS_MONTH | 
                The previous completed calendar month. | 
PREVIOUS_QUARTER | 
                The previous completed quarter. | 
PREVIOUS_YEAR | 
                The previous completed calendar year. | 
LAST_7_DAYS | 
                The previous 7 days, excluding the current day. | 
LAST_30_DAYS | 
                The previous 30 days, excluding the current day. | 
LAST_90_DAYS | 
                The previous 90 days, excluding the current day. | 
LAST_365_DAYS | 
                The previous 365 days, excluding the current day. | 
ALL_TIME | 
                All time for which data is available, excluding the current day. | 
LAST_14_DAYS | 
                The previous 14 days, excluding the current day. | 
LAST_60_DAYS | 
                The previous 60 days, excluding the current day. | 
QuerySchedule
Settings on when and how frequently to run a query.
| JSON representation | 
|---|
{ "startDate": { object (  | 
              
| Fields | |
|---|---|
startDate | 
                
                   
 The date on which to begin the scheduled runs. This field is required if   | 
              
endDate | 
                
                   
 The date on which to end the scheduled runs. This field is required if   | 
              
frequency | 
                
                   
 How frequently to run the query. If set to   | 
              
nextRunTimezoneCode | 
                
                   
 The canonical code for the timezone the query schedule is based on. Scheduled runs are usually conducted in the morning of a given day. Defaults to   | 
              
Frequency
Available frequencies in which a query can be scheduled to run.
| Enums | |
|---|---|
FREQUENCY_UNSPECIFIED | 
                Default value when frequency is not specified or is unknown in this version. | 
ONE_TIME | 
                Only when the query is run manually. | 
DAILY | 
                Once a day. | 
WEEKLY | 
                Once a week. | 
SEMI_MONTHLY | 
                Twice a month. | 
MONTHLY | 
                Once a month. | 
QUARTERLY | 
                Once a quarter. | 
YEARLY | 
                Once a year. | 
Methods | 
            |
|---|---|
                
 | 
              Creates a new query. | 
                
 | 
              Deletes an existing query as well as its generated reports. | 
                
 | 
              Retrieves a query. | 
                
 | 
              Lists queries created by the current user. | 
                
 | 
              Runs an existing query to generate a report. |