diff --git a/ChangeLog b/ChangeLog index 8613c576..31f4bdd8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +11.0.1 -- 04/06/18 +* Fixed bug related to creating types from services that + contain multiple schemas. +* Fixed bug in README.md related to zeep caching. + 11.0.0 -- 03/21/18 * Removed support and examples for AdWords v201705, and v201708. * The default SOAP backend is now zeep. If you encounter any issues, diff --git a/README.md b/README.md index 147dcd43..254ee506 100644 --- a/README.md +++ b/README.md @@ -222,7 +222,8 @@ You can also disable caching in similar fashion with zeep ```python adwords_client = adwords.AdWordsClient( developer_token, oauth2_client, user_agent, - client_customer_id=client_customer_id, cache=None) + client_customer_id=client_customer_id, + cache=googleads.common.ZeepServiceProxy.NO_CACHE) ``` And with suds: diff --git a/examples/adwords/v201710/optimization/estimate_keyword_traffic.py b/examples/adwords/v201710/optimization/estimate_keyword_traffic.py index 0b96d72a..5250262e 100755 --- a/examples/adwords/v201710/optimization/estimate_keyword_traffic.py +++ b/examples/adwords/v201710/optimization/estimate_keyword_traffic.py @@ -157,10 +157,12 @@ def DisplayEstimate(message, min_estimate, max_estimate): # Find the mean of the min and max values. mean_avg_cpc = (_CalculateMean(min_estimate['averageCpc']['microAmount'], max_estimate['averageCpc']['microAmount']) - if 'averageCpc' in min_estimate else None) + if 'averageCpc' in min_estimate + and min_estimate['averageCpc'] else None) mean_avg_pos = (_CalculateMean(min_estimate['averagePosition'], max_estimate['averagePosition']) - if 'averagePosition' in min_estimate else None) + if 'averagePosition' in min_estimate + and min_estimate['averagePosition'] else None) mean_clicks = _CalculateMean(min_estimate['clicksPerDay'], max_estimate['clicksPerDay']) mean_total_cost = _CalculateMean(min_estimate['totalCost']['microAmount'], diff --git a/examples/adwords/v201802/optimization/estimate_keyword_traffic.py b/examples/adwords/v201802/optimization/estimate_keyword_traffic.py index 28465e7a..1d9575ac 100755 --- a/examples/adwords/v201802/optimization/estimate_keyword_traffic.py +++ b/examples/adwords/v201802/optimization/estimate_keyword_traffic.py @@ -157,10 +157,12 @@ def DisplayEstimate(message, min_estimate, max_estimate): # Find the mean of the min and max values. mean_avg_cpc = (_CalculateMean(min_estimate['averageCpc']['microAmount'], max_estimate['averageCpc']['microAmount']) - if 'averageCpc' in min_estimate else None) + if 'averageCpc' in min_estimate + and min_estimate['averageCpc'] else None) mean_avg_pos = (_CalculateMean(min_estimate['averagePosition'], max_estimate['averagePosition']) - if 'averagePosition' in min_estimate else None) + if 'averagePosition' in min_estimate + and min_estimate['averagePosition'] else None) mean_clicks = _CalculateMean(min_estimate['clicksPerDay'], max_estimate['clicksPerDay']) mean_total_cost = _CalculateMean(min_estimate['totalCost']['microAmount'], diff --git a/examples/dfp/v201708/live_stream_event_service/activate_live_stream_events.py b/examples/dfp/v201708/live_stream_event_service/activate_live_stream_events.py new file mode 100755 index 00000000..fa0a8f2a --- /dev/null +++ b/examples/dfp/v201708/live_stream_event_service/activate_live_stream_events.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example activates paused live stream events.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set the id of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201708') + + # Create query to find paused live stream events. + statement = (dfp.StatementBuilder() + .Where(('id = :id AND ' + 'status = :status')) + .WithBindVariable('status', 'PAUSED') + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + live_stream_events_activated = 0 + + # Get live stream events by statement. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + print('live stream event with id "%s" and name "%s" will be activated.' + % (live_stream_event['id'], live_stream_event['name'])) + + # Perform action. + result = live_stream_event_service.performLiveStreamEventAction({ + 'xsi_type': 'ActivateLiveStreamEvents' + }, statement.ToStatement()) + if result and int(result['numChanges']) > 0: + live_stream_events_activated += int(result['numChanges']) + statement.offset += dfp.SUGGESTED_PAGE_LIMIT + else: + break + + # Display results. + if live_stream_events_activated > 0: + print '# of live stream events activated: %s' % ( + live_stream_events_activated) + else: + print 'No live stream events were activated.' + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/examples/dfp/v201708/live_stream_event_service/create_live_stream_events.py b/examples/dfp/v201708/live_stream_event_service/create_live_stream_events.py new file mode 100755 index 00000000..5ce194c3 --- /dev/null +++ b/examples/dfp/v201708/live_stream_event_service/create_live_stream_events.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example creates new live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +To determine which cdn configurations exist, run get_cdn_configurations.py. +""" + +import datetime +import uuid + +# Import appropriate modules from the client library. +from googleads import dfp +import pytz + +# Set content urls and adTags to use +CONTENT_URLS = ['INSERT_CONTENT_URLS_HERE'] +AD_TAGS = ['INSERT_AD_TAGS_HERE'] + + +def main(client, content_urls, ad_tags): + # Initialize appropriate services. + live_events_service = client.GetService( + 'LiveStreamEventService', version='v201708') + + # Stream will play for 365 days + start_datetime = datetime.datetime.now(tz=pytz.timezone('America/New_York')) + end_datetime = start_datetime + datetime.timedelta(days=365) + + # Create live stream event objects + live_stream_events = [{ + 'name': 'Live Stream Event #%s' % uuid.uuid4(), + 'startDateTime': start_datetime, + 'endDateTime': end_datetime, + 'contentUrls': content_urls, + 'adTags': ad_tags + }] + + # Add live stream events. + live_stream_events = live_events_service.createLiveStreamEvents( + live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print( + 'Live stream event with id "%s", named "%s" and status %s was created.' + % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, CONTENT_URLS, AD_TAGS) diff --git a/examples/dfp/v201708/live_stream_event_service/get_all_live_stream_events.py b/examples/dfp/v201708/live_stream_event_service/get_all_live_stream_events.py new file mode 100755 index 00000000..a6eccb88 --- /dev/null +++ b/examples/dfp/v201708/live_stream_event_service/get_all_live_stream_events.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example gets all live stream events. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + + +def main(client): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201708') + + # Create a statement to select live stream events. + statement = dfp.StatementBuilder() + + # Retrieve a small amount of live stream events at a time, paging + # through until all live stream events have been retrieved. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + # Print out some information for each live stream event. + print('live stream event with id "%d" and name "%s" was found.' % + (live_stream_event['id'], live_stream_event['name'])) + statement.offset += statement.limit + else: + break + + print '\nNumber of results found: %s' % response['totalResultSetSize'] + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client) diff --git a/examples/dfp/v201708/live_stream_event_service/register_sessions_for_monitoring.py b/examples/dfp/v201708/live_stream_event_service/register_sessions_for_monitoring.py new file mode 100755 index 00000000..906ff712 --- /dev/null +++ b/examples/dfp/v201708/live_stream_event_service/register_sessions_for_monitoring.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example registers all live stream event-sessions ids for monitoring.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# List of session ids +SESSION_IDS = ['INSERT_SESSION_IDS_HERE'] + + +def main(client, session_ids): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201708') + + # Retrieve all sessions id that are being monitored + session_ids = live_stream_event_service.registerSessionsForMonitoring( + session_ids) + if session_ids: + for session_id in session_ids: + # Print out some information for each live stream event. + print 'Session with ID "%s" registered for monitoring.' % (session_id) + + print '\nNumber of results found: %s' % session_ids.size + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, SESSION_IDS) diff --git a/examples/dfp/v201708/live_stream_event_service/update_live_stream_events.py b/examples/dfp/v201708/live_stream_event_service/update_live_stream_events.py new file mode 100755 index 00000000..3bae28dd --- /dev/null +++ b/examples/dfp/v201708/live_stream_event_service/update_live_stream_events.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example updates live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set ID of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate services. + live_stream_events_service = client.GetService( + 'LiveStreamEventService', version='v201708') + + # Create statement object to only select matching live stream event. + statement = (dfp.StatementBuilder() + .Where(('Id = :id')) + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + # Get live stream events by statement. + response = live_stream_events_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + + # Set adTags to be updated. + new_ad_tags = ['INSERT_NEW_AD_TAGS_HERE'] + + if 'results' in response: + # Update each local live stream event by changing its attributes. + updated_live_stream_events = [] + for live_stream_event in response['results']: + live_stream_event['startDateTimeType'] = 'IMMEDIATELY' + live_stream_event['adTags'] = new_ad_tags + updated_live_stream_events.append(live_stream_event) + + # Update live stream events. + live_stream_events = live_stream_events_service.updateLiveStreamEvents( + updated_live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print('Live stream event with id "%s", named "%s" and status %s was ' + 'updated.' % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/examples/dfp/v201711/live_stream_event_service/activate_live_stream_events.py b/examples/dfp/v201711/live_stream_event_service/activate_live_stream_events.py new file mode 100755 index 00000000..6074664b --- /dev/null +++ b/examples/dfp/v201711/live_stream_event_service/activate_live_stream_events.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example activates paused live stream events.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set the id of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201711') + + # Create query to find paused live stream events. + statement = (dfp.StatementBuilder() + .Where(('id = :id AND ' + 'status = :status')) + .WithBindVariable('status', 'PAUSED') + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + live_stream_events_activated = 0 + + # Get live stream events by statement. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + print('live stream event with id "%s" and name "%s" will be activated.' + % (live_stream_event['id'], live_stream_event['name'])) + + # Perform action. + result = live_stream_event_service.performLiveStreamEventAction({ + 'xsi_type': 'ActivateLiveStreamEvents' + }, statement.ToStatement()) + if result and int(result['numChanges']) > 0: + live_stream_events_activated += int(result['numChanges']) + statement.offset += dfp.SUGGESTED_PAGE_LIMIT + else: + break + + # Display results. + if live_stream_events_activated > 0: + print '# of live stream events activated: %s' % ( + live_stream_events_activated) + else: + print 'No live stream events were activated.' + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/examples/dfp/v201711/live_stream_event_service/create_live_stream_events.py b/examples/dfp/v201711/live_stream_event_service/create_live_stream_events.py new file mode 100755 index 00000000..d8769d38 --- /dev/null +++ b/examples/dfp/v201711/live_stream_event_service/create_live_stream_events.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example creates new live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +To determine which cdn configurations exist, run get_cdn_configurations.py. +""" + +import datetime +import uuid + +# Import appropriate modules from the client library. +from googleads import dfp +import pytz + +# Set content urls and adTags to use +CONTENT_URLS = ['INSERT_CONTENT_URLS_HERE'] +AD_TAGS = ['INSERT_AD_TAGS_HERE'] + + +def main(client, content_urls, ad_tags): + # Initialize appropriate services. + live_events_service = client.GetService( + 'LiveStreamEventService', version='v201711') + + # Stream will play for 365 days + start_datetime = datetime.datetime.now(tz=pytz.timezone('America/New_York')) + end_datetime = start_datetime + datetime.timedelta(days=365) + + # Create live stream event objects + live_stream_events = [{ + 'name': 'Live Stream Event #%s' % uuid.uuid4(), + 'startDateTime': start_datetime, + 'endDateTime': end_datetime, + 'contentUrls': content_urls, + 'adTags': ad_tags + }] + + # Add live stream events. + live_stream_events = live_events_service.createLiveStreamEvents( + live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print( + 'Live stream event with id "%s", named "%s" and status %s was created.' + % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, CONTENT_URLS, AD_TAGS) diff --git a/examples/dfp/v201711/live_stream_event_service/get_all_live_stream_events.py b/examples/dfp/v201711/live_stream_event_service/get_all_live_stream_events.py new file mode 100755 index 00000000..9154377a --- /dev/null +++ b/examples/dfp/v201711/live_stream_event_service/get_all_live_stream_events.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example gets all live stream events. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + + +def main(client): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201711') + + # Create a statement to select live stream events. + statement = dfp.StatementBuilder() + + # Retrieve a small amount of live stream events at a time, paging + # through until all live stream events have been retrieved. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + # Print out some information for each live stream event. + print('live stream event with id "%d" and name "%s" was found.' % + (live_stream_event['id'], live_stream_event['name'])) + statement.offset += statement.limit + else: + break + + print '\nNumber of results found: %s' % response['totalResultSetSize'] + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client) diff --git a/examples/dfp/v201711/live_stream_event_service/register_sessions_for_monitoring.py b/examples/dfp/v201711/live_stream_event_service/register_sessions_for_monitoring.py new file mode 100755 index 00000000..7a155778 --- /dev/null +++ b/examples/dfp/v201711/live_stream_event_service/register_sessions_for_monitoring.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example registers all live stream event-sessions ids for monitoring.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# List of session ids +SESSION_IDS = ['INSERT_SESSION_IDS_HERE'] + + +def main(client, session_ids): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201711') + + # Retrieve all sessions id that are being monitored + session_ids = live_stream_event_service.registerSessionsForMonitoring( + session_ids) + if session_ids: + for session_id in session_ids: + # Print out some information for each live stream event. + print 'Session with ID "%s" registered for monitoring.' % (session_id) + + print '\nNumber of results found: %s' % session_ids.size + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, SESSION_IDS) diff --git a/examples/dfp/v201711/live_stream_event_service/update_live_stream_events.py b/examples/dfp/v201711/live_stream_event_service/update_live_stream_events.py new file mode 100755 index 00000000..95653f6f --- /dev/null +++ b/examples/dfp/v201711/live_stream_event_service/update_live_stream_events.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example updates live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set ID of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate services. + live_stream_events_service = client.GetService( + 'LiveStreamEventService', version='v201711') + + # Create statement object to only select matching live stream event. + statement = (dfp.StatementBuilder() + .Where(('Id = :id')) + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + # Get live stream events by statement. + response = live_stream_events_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + + # Set adTags to be updated. + new_ad_tags = ['INSERT_NEW_AD_TAGS_HERE'] + + if 'results' in response: + # Update each local live stream event by changing its attributes. + updated_live_stream_events = [] + for live_stream_event in response['results']: + live_stream_event['startDateTimeType'] = 'IMMEDIATELY' + live_stream_event['adTags'] = new_ad_tags + updated_live_stream_events.append(live_stream_event) + + # Update live stream events. + live_stream_events = live_stream_events_service.updateLiveStreamEvents( + updated_live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print('Live stream event with id "%s", named "%s" and status %s was ' + 'updated.' % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/examples/dfp/v201802/live_stream_event_service/activate_live_stream_events.py b/examples/dfp/v201802/live_stream_event_service/activate_live_stream_events.py new file mode 100755 index 00000000..04b5d933 --- /dev/null +++ b/examples/dfp/v201802/live_stream_event_service/activate_live_stream_events.py @@ -0,0 +1,71 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example activates paused live stream events.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set the id of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201802') + + # Create query to find paused live stream events. + statement = (dfp.StatementBuilder() + .Where(('id = :id AND ' + 'status = :status')) + .WithBindVariable('status', 'PAUSED') + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + live_stream_events_activated = 0 + + # Get live stream events by statement. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + print('live stream event with id "%s" and name "%s" will be activated.' + % (live_stream_event['id'], live_stream_event['name'])) + + # Perform action. + result = live_stream_event_service.performLiveStreamEventAction({ + 'xsi_type': 'ActivateLiveStreamEvents' + }, statement.ToStatement()) + if result and int(result['numChanges']) > 0: + live_stream_events_activated += int(result['numChanges']) + statement.offset += dfp.SUGGESTED_PAGE_LIMIT + else: + break + + # Display results. + if live_stream_events_activated > 0: + print '# of live stream events activated: %s' % ( + live_stream_events_activated) + else: + print 'No live stream events were activated.' + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/examples/dfp/v201802/live_stream_event_service/create_live_stream_events.py b/examples/dfp/v201802/live_stream_event_service/create_live_stream_events.py new file mode 100755 index 00000000..927fe5fa --- /dev/null +++ b/examples/dfp/v201802/live_stream_event_service/create_live_stream_events.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example creates new live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +To determine which cdn configurations exist, run get_cdn_configurations.py. +""" + +import datetime +import uuid + +# Import appropriate modules from the client library. +from googleads import dfp +import pytz + +# Set content urls and adTags to use +CONTENT_URLS = ['INSERT_CONTENT_URLS_HERE'] +AD_TAGS = ['INSERT_AD_TAGS_HERE'] + + +def main(client, content_urls, ad_tags): + # Initialize appropriate services. + live_events_service = client.GetService( + 'LiveStreamEventService', version='v201802') + + # Stream will play for 365 days + start_datetime = datetime.datetime.now(tz=pytz.timezone('America/New_York')) + end_datetime = start_datetime + datetime.timedelta(days=365) + + # Create live stream event objects + live_stream_events = [{ + 'name': 'Live Stream Event #%s' % uuid.uuid4(), + 'startDateTime': start_datetime, + 'endDateTime': end_datetime, + 'contentUrls': content_urls, + 'adTags': ad_tags + }] + + # Add live stream events. + live_stream_events = live_events_service.createLiveStreamEvents( + live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print( + 'Live stream event with id "%s", named "%s" and status %s was created.' + % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, CONTENT_URLS, AD_TAGS) diff --git a/examples/dfp/v201802/live_stream_event_service/get_all_live_stream_events.py b/examples/dfp/v201802/live_stream_event_service/get_all_live_stream_events.py new file mode 100755 index 00000000..b8b4a57d --- /dev/null +++ b/examples/dfp/v201802/live_stream_event_service/get_all_live_stream_events.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example gets all live stream events. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + + +def main(client): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201802') + + # Create a statement to select live stream events. + statement = dfp.StatementBuilder() + + # Retrieve a small amount of live stream events at a time, paging + # through until all live stream events have been retrieved. + while True: + response = live_stream_event_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + if 'results' in response: + for live_stream_event in response['results']: + # Print out some information for each live stream event. + print('live stream event with id "%d" and name "%s" was found.' % + (live_stream_event['id'], live_stream_event['name'])) + statement.offset += statement.limit + else: + break + + print '\nNumber of results found: %s' % response['totalResultSetSize'] + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client) diff --git a/examples/dfp/v201802/live_stream_event_service/register_sessions_for_monitoring.py b/examples/dfp/v201802/live_stream_event_service/register_sessions_for_monitoring.py new file mode 100755 index 00000000..9330bb0f --- /dev/null +++ b/examples/dfp/v201802/live_stream_event_service/register_sessions_for_monitoring.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This example registers all live stream event-sessions ids for monitoring.""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# List of session ids +SESSION_IDS = ['INSERT_SESSION_IDS_HERE'] + + +def main(client, session_ids): + # Initialize appropriate service. + live_stream_event_service = client.GetService( + 'LiveStreamEventService', version='v201802') + + # Retrieve all sessions id that are being monitored + session_ids = live_stream_event_service.registerSessionsForMonitoring( + session_ids) + if session_ids: + for session_id in session_ids: + # Print out some information for each live stream event. + print 'Session with ID "%s" registered for monitoring.' % (session_id) + + print '\nNumber of results found: %s' % session_ids.size + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, SESSION_IDS) diff --git a/examples/dfp/v201802/live_stream_event_service/update_live_stream_events.py b/examples/dfp/v201802/live_stream_event_service/update_live_stream_events.py new file mode 100755 index 00000000..2023e9ae --- /dev/null +++ b/examples/dfp/v201802/live_stream_event_service/update_live_stream_events.py @@ -0,0 +1,69 @@ +#!/usr/bin/env python +# +# Copyright 2018 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""This code example updates live stream events. + +To determine which live stream events exist, run get_all_live_stream_events.py. +""" + +# Import appropriate modules from the client library. +from googleads import dfp + +# Set ID of the LiveStreamEvent to get live stream events from. +LIVE_STREAM_EVENT_ID = 'INSERT_LIVE_STREAM_EVENT_ID_HERE' + + +def main(client, live_stream_event_id): + # Initialize appropriate services. + live_stream_events_service = client.GetService( + 'LiveStreamEventService', version='v201802') + + # Create statement object to only select matching live stream event. + statement = (dfp.StatementBuilder() + .Where(('Id = :id')) + .WithBindVariable('id', long(live_stream_event_id)) + .Limit(500)) + + # Get live stream events by statement. + response = live_stream_events_service.getLiveStreamEventsByStatement( + statement.ToStatement()) + + # Set adTags to be updated. + new_ad_tags = ['INSERT_NEW_AD_TAGS_HERE'] + + if 'results' in response: + # Update each local live stream event by changing its attributes. + updated_live_stream_events = [] + for live_stream_event in response['results']: + live_stream_event['startDateTimeType'] = 'IMMEDIATELY' + live_stream_event['adTags'] = new_ad_tags + updated_live_stream_events.append(live_stream_event) + + # Update live stream events. + live_stream_events = live_stream_events_service.updateLiveStreamEvents( + updated_live_stream_events) + + # Display results. + for live_stream_event in live_stream_events: + print('Live stream event with id "%s", named "%s" and status %s was ' + 'updated.' % (live_stream_event['id'], live_stream_event['name'], + live_stream_event['status'])) + + +if __name__ == '__main__': + # Initialize client object. + dfp_client = dfp.DfpClient.LoadFromStorage() + main(dfp_client, LIVE_STREAM_EVENT_ID) diff --git a/googleads/common.py b/googleads/common.py index 1e94b963..3ea06a9b 100644 --- a/googleads/common.py +++ b/googleads/common.py @@ -78,7 +78,7 @@ 'compatibility with this library, upgrade to Python 2.7.9 or higher.') -VERSION = '11.0.0' +VERSION = '11.0.1' _COMMON_LIB_SIG = 'googleads/%s' % VERSION _LOGGING_KEY = 'logging' _HTTP_PROXY_YAML_KEY = 'http' @@ -1239,8 +1239,18 @@ def _PackArgumentsHelper(self, elem, data, set_type_attrs): if isinstance(data, dict): # Dict so it's a complex type. xsi_type = data.get('xsi_type') if xsi_type: # This has a type override so look it up. - elem_type = self.zeep_client.get_type( - '{%s}%s' % (self._GetBindingNamespace(), xsi_type)) + elem_type = None + last_exception = None + for ns_prefix in self.zeep_client.wsdl.types.prefix_map.values(): + try: + elem_type = self.zeep_client.get_type( + '{%s}%s' % (ns_prefix, xsi_type)) + except zeep.exceptions.LookupError as e: + last_exception = e + continue + break + if not elem_type: + raise last_exception else: elem_type = elem.type elem_arguments = dict(elem_type.elements) diff --git a/tests/common_test.py b/tests/common_test.py index e460867f..a99e8852 100644 --- a/tests/common_test.py +++ b/tests/common_test.py @@ -1136,6 +1136,26 @@ def testPackArgumentsBase64Warning(self): self.zeep_client._PackArgumentsHelper(b64_type, data, False) self.assertTrue(len(googleads.common._logger.warn.mock_calls)) + def testPackArgumentsMultipleSchemas(self): + header_handler = mock.Mock() + + wsdl_path = os.path.join( + TEST_DIR, 'test_data/traffic_estimator_service.xml') + zeep_client = googleads.common.ZeepServiceProxy( + wsdl_path, header_handler, None, googleads.common.ProxyConfig(), 100) + + element = zeep_client.zeep_client.get_type('ns0:Criterion') + data = {'xsi_type': 'Location', 'id': '2840'} + + result = zeep_client._PackArgumentsHelper(element, data, False) + self.assertEqual(result.id, '2840') + + def testPackArgumentsBadType(self): + element = self.zeep_client.zeep_client.get_type('ns0:Image') + data = {'xsi_type': 'nope'} + with self.assertRaises(zeep.exceptions.LookupError): + self.zeep_client._PackArgumentsHelper(element, data, False) + class SudsServiceProxyTest(unittest.TestCase): """Tests for the googleads.common.SudsServiceProxy class.""" diff --git a/tests/test_data/traffic_estimator_service.xml b/tests/test_data/traffic_estimator_service.xml new file mode 100644 index 00000000..23c762c4 --- /dev/null +++ b/tests/test_data/traffic_estimator_service.xml @@ -0,0 +1,3313 @@ + + + + + + + + + + Errors that are thrown when a non-AdX feature is accessed by an AdX customer. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + The API error base class that provides details about an error that occurred + while processing a service request. + + <p>The OGNL field path is provided for parsers to identify the request data + element that may have caused the error.</p> + + + + + + + The OGNL field path to identify cause of error. + + + + + + + A parsed copy of the field path. For example, the field path "operations[1].operand" + corresponds to this list: {FieldPathElement(field = "operations", index = 1), + FieldPathElement(field = "operand", index = null)}. + + + + + + + The data that caused the error. + + + + + + + A simple string representation of the error and reason. + + + + + + + Indicates that this instance is a subtype of ApiError. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Exception class for holding a list of service errors. + + + + + + + + + List of errors. + + + + + + + + + + + Base class for exceptions. + + + + + + + Error message. + + + + + + + Indicates that this instance is a subtype of ApplicationException. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Errors returned when Authentication failed. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Errors encountered when trying to authorize a user. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Error due to user not accepting the AdWords terms of service. + + + + + + + + + + + + + + Errors associated with the size of the given collection being + out of bounds. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Comparable types for constructing ranges with. + + + + + + + Indicates that this instance is a subtype of ComparableValue. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Represents a criterion (such as a keyword, placement, or vertical). + <span class="constraint AdxEnabled">This is disabled for AdX when it is contained within Operators: ADD, SET.</span> + + + + + + + ID of this criterion. + <span class="constraint Selectable">This field can be selected using the value "Id".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : SET, REMOVE.</span> + + + + + + + <span class="constraint Selectable">This field can be selected using the value "CriteriaType".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + Indicates that this instance is a subtype of Criterion. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Errors that are thrown due to a database access problem. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Errors associated with invalid dates and date ranges. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Errors related to distinct ids or content. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Number value type for constructing double valued ranges. + + + + + + + + + the underlying double value. + + + + + + + + + + + Reports permission problems trying to access an entity. + + + + + + + + + Reason for this error. + + + + + + + + + + + An id did not correspond to an entity, or it referred to an entity which does not belong to the + customer. + + + + + + + + + Reason for this error. + + + + + + + + + + + A segment of a field path. Each dot in a field path defines a new segment. + + + + + + + The name of a field in lower camelcase. (e.g. "biddingStrategy") + + + + + + + For list fields, this is a 0-indexed position in the list. Null for non-list fields. + + + + + + + + + Errors associated with the ids. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Indicates that a server-side error has occured. {@code InternalApiError}s + are generally not the result of an invalid request or message sent by the + client. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Represents a keyword. + <span class="constraint AdxEnabled">This is disabled for AdX when it is contained within Operators: ADD, SET.</span> + + + + + + + + + Text of this keyword (at most 80 characters and ten words). + <span class="constraint Selectable">This field can be selected using the value "KeywordText".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint MatchesRegex">Keyword text must not contain NUL (code point 0x0) characters. This is checked by the regular expression '[^\x00]*'.</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : ADD.</span> + + + + + + + Match type of this keyword. + <span class="constraint Selectable">This field can be selected using the value "KeywordMatchType".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : ADD.</span> + + + + + + + + + + + Represents a Language criterion. + <p>A criterion of this type can only be created using an ID. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Represents Location criterion. + <p>A criterion of this type can only be created using an ID. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + Name of the location criterion. <b> Note:</b> This field is filterable only in + LocationCriterionService. If used as a filter, a location name cannot be greater than 300 + characters. + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + Display type of the location criterion. + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + The targeting status of the location criterion. + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + Ordered list of parents of the location criterion. + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Number value type for constructing long valued ranges. + + + + + + + + + the underlying long value. + + + + + + + + + + + Represents the mobile app category to be targeted. + <a href="/adwords/api/docs/appendix/mobileappcategories">View the complete list of + available mobile app categories</a>. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + ID of this mobile app category. A complete list of the available mobile app categories is + available <a href="/adwords/api/docs/appendix/mobileappcategories">here</a>. + <span class="constraint Selectable">This field can be selected using the value "MobileAppCategoryId".</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : ADD.</span> + + + + + + + Name of this mobile app category. + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Represents the mobile application to be targeted. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + A string that uniquely identifies a mobile application to AdWords API. The format of this + string is "<code>{platform}-{platform_native_id}</code>", where <code>platform</code> is "1" + for iOS apps and "2" for Android apps, and where <code>platform_native_id</code> is the mobile + application identifier native to the corresponding platform. + For iOS, this native identifier is the 9 digit string that appears at the end of an App Store + URL (e.g., "476943146" for "Flood-It! 2" whose App Store link is + http://itunes.apple.com/us/app/flood-it!-2/id476943146). + For Android, this native identifier is the application's package name (e.g., + "com.labpixies.colordrips" for "Color Drips" given Google Play link + https://play.google.com/store/apps/details?id=com.labpixies.colordrips). + A well formed app id for AdWords API would thus be "1-476943146" for iOS and + "2-com.labpixies.colordrips" for Android. + <span class="constraint Selectable">This field can be selected using the value "AppId".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : ADD.</span> + + + + + + + Title of this mobile application. + <span class="constraint Selectable">This field can be selected using the value "DisplayName".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Represents a money amount. + + + + + + + + + Amount in micros. One million is equivalent to one unit. + + + + + + + + + + + Network settings for a Campaign. + + + + + + + Ads will be served with Google.com search results. + <span class="constraint AdxEnabled">This is disabled for AdX.</span> + <span class="constraint CampaignType">This field may only be set to true for campaign channel type SEARCH.</span> +<span class="constraint CampaignType">This field may only be set to true for campaign channel subtype UNIVERSAL_APP_CAMPAIGN.</span> +<span class="constraint CampaignType">This field may only be set to false for campaign channel type DISPLAY.</span> +<span class="constraint CampaignType">This field may only be set to true for campaign channel subtype SHOPPING_UNIVERSAL_ADS.</span> + + + + + + + Ads will be served on partner sites in the Google Search Network + (requires {@code GOOGLE_SEARCH}). + <span class="constraint AdxEnabled">This is disabled for AdX.</span> + <span class="constraint CampaignType">This field may only be set to true for campaign channel subtype UNIVERSAL_APP_CAMPAIGN.</span> +<span class="constraint CampaignType">This field may only be set to true for campaign channel subtype SHOPPING_UNIVERSAL_ADS.</span> + + + + + + + Ads will be served on specified placements in the Google Display Network. + Placements are specified using {@code Placement} criteria. + <span class="constraint CampaignType">This field may only be set to true for campaign channel subtype UNIVERSAL_APP_CAMPAIGN.</span> +<span class="constraint CampaignType">This field may only be set to false for campaign channel subtype SEARCH_MOBILE_APP.</span> +<span class="constraint CampaignType">This field may only be set to true for campaign channel subtype SHOPPING_UNIVERSAL_ADS.</span> + + + + + + + Ads will be served on the Google Partner Network. This is available to + only some specific Google partner accounts. + <span class="constraint AdxEnabled">This is disabled for AdX.</span> + <span class="constraint CampaignType">This field may only be set to false for campaign channel subtype UNIVERSAL_APP_CAMPAIGN.</span> + + + + + + + + + Errors corresponding with violation of a NOT EMPTY check. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Errors associated with violation of a NOT NULL check. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Number value types for constructing number valued ranges. + + + + + + + + + + + + Operation not permitted due to the invoked service's access policy. + + + + + + + + + + + + + + Errors due to the use of unsupported operations. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + A placement used for modifying bids for sites when targeting the content + network. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + Url of the placement. + + <p>For example, "http://www.domain.com". + <span class="constraint Selectable">This field can be selected using the value "PlacementUrl".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint Required">This field is required and should not be {@code null} when it is contained within {@link Operator}s : ADD.</span> + + + + + + + + + + + Represents Platform criterion. + <p>A criterion of this type can only be created using an ID. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Encapsulates the errors thrown during developer quota checks. + + + + + + + + + + + + + + A list of all errors associated with the Range constraint. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Signals that a call failed because a measured rate exceeded. + + + + + + + + + The error reason represented by an enum. + + + + + + + Cause of the rate exceeded error. + + + + + + + The scope of the rate (ACCOUNT/DEVELOPER). + + + + + + + The amount of time (in seconds) the client should wait before retrying the request. + + + + + + + + + + + Errors from attempting to write to read-only fields. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + A list of all errors associated with the @RegionCode constraints. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Indicates that a field was rejected due to compatibility issues. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Encapsulates the generic errors thrown when there's an error with user + request. + + + + + + + + + + + + + + Errors due to missing required field. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Indicates that the number of entries in the request or response exceeds the system limit. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Defines the required and optional elements within the header of a SOAP request. + + + + + + + The header identifies the customer id of the client of the AdWords manager, if an AdWords + manager is acting on behalf of their client or the customer id of the advertiser managing their + own account. + + + + + + + Developer token to identify that the person making the call has enough + quota. + + + + + + + UserAgent is used to track distribution of API client programs and + application usage. The client is responsible for putting in a meaningful + value for tracking purposes. To be clear this is not the same as an HTTP + user agent. + + + + + + + Used to validate the request without executing it. + + + + + + + If true, API will try to commit as many error free operations as possible and + report the other operations' errors. + + <p>Ignored for non-mutate calls. + + + + + + + + + Defines the elements within the header of a SOAP response. + + + + + + + Unique id that identifies this request. If developers have any support issues, sending us + this id will enable us to find their request more easily. + + + + + + + The name of the service being invoked. + + + + + + + The name of the method being invoked. + + + + + + + Number of operations performed for this SOAP request. + + + + + + + Elapsed time in milliseconds between the AdWords API receiving the request and sending the + response. + + + + + + + + + A list of error code for reporting invalid content of input strings. + + + + + + + + + + + + + + Errors associated with the length of the given string being + out of bounds. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + User Interest represents a particular interest-based vertical to be targeted. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + Id of this user interest. This is a required field. + <span class="constraint Selectable">This field can be selected using the value "UserInterestId".</span> + + + + + + + Parent Id of this user interest. + <span class="constraint Selectable">This field can be selected using the value "UserInterestParentId".</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + Name of this user interest. + <span class="constraint Selectable">This field can be selected using the value "UserInterestName".</span> + + + + + + + + + + + UserList - represents a user list that is defined by the advertiser to be targeted. + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + Id of this user list. This is a required field. + <span class="constraint Selectable">This field can be selected using the value "UserListId".</span> + + + + + + + <span class="constraint Selectable">This field can be selected using the value "UserListName".</span> + + + + + + + <span class="constraint Selectable">This field can be selected using the value "UserListMembershipStatus".</span><span class="constraint Filterable">This field can be filtered on.</span> + + + + + + + Determines whether a user list is eligible for targeting in the google.com + (search) network. + <span class="constraint Selectable">This field can be selected using the value "UserListEligibleForSearch".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + Determines whether a user list is eligible for targeting in the display network. + <span class="constraint Selectable">This field can be selected using the value "UserListEligibleForDisplay".</span><span class="constraint Filterable">This field can be filtered on.</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + + + + + Use verticals to target or exclude placements in the Google Display Network + based on the category into which the placement falls (for example, "Pets &amp; + Animals/Pets/Dogs"). + <a href="/adwords/api/docs/appendix/verticals">View the complete list + of available vertical categories.</a> + <span class="constraint AdxEnabled">This is enabled for AdX.</span> + + + + + + + + + Id of this vertical. + <span class="constraint Selectable">This field can be selected using the value "VerticalId".</span> + + + + + + + Id of the parent of this vertical. + <span class="constraint Selectable">This field can be selected using the value "VerticalParentId".</span> + <span class="constraint ReadOnly">This field is read only and will be ignored when sent to the API.</span> + + + + + + + The category to target or exclude. Each subsequent element in the array + describes a more specific sub-category. For example, + <code>{"Pets &amp; Animals", "Pets", "Dogs"}</code> represents the "Pets &amp; + Animals/Pets/Dogs" category. A complete list of available vertical categories + is available <a href="/adwords/api/docs/appendix/verticals">here</a> + This field is required and must not be empty. + <span class="constraint Selectable">This field can be selected using the value "Path".</span> + + + + + + + + + + + The reasons for the AdX error. + + + + + + + Attempt to use non-AdX feature by AdX customer. + + + + + + + + + The single reason for the authentication failure. + + + + + + + Authentication of the request failed. + + + + + + + Client Customer Id is required if CustomerIdMode is set to CLIENT_EXTERNAL_CUSTOMER_ID. + Starting version V201409 ClientCustomerId will be required for all requests except + for {@link CustomerService#get} + + + + + + + Client Email is required if CustomerIdMode is set to CLIENT_EXTERNAL_EMAIL_FIELD. + + + + + + + Client customer Id is not a number. + + + + + + + Client customer Id is not a number. + + + + + + + Client email is not a valid customer email. + + + + + + + No customer found for the customer id provided in the header. + + + + + + + Client's Google Account is deleted. + + + + + + + Google account login token in the cookie is invalid. + + + + + + + problem occurred during Google account authentication. + + + + + + + The user in the google account login token does not match the UserId in the cookie. + + + + + + + Login cookie is required for authentication. + + + + + + + User in the cookie is not a valid Ads user. + + + + + + + Oauth token in the header is not valid. + + + + + + + Oauth token in the header has expired. + + + + + + + Oauth token in the header has been disabled. + + + + + + + Oauth token in the header has been revoked. + + + + + + + Oauth token HTTP header is malformed. + + + + + + + Login cookie is not valid. + + + + + + + Failed to decrypt the login cookie. + + + + + + + User Id in the header is not a valid id. + + + + + + + + + The reasons for the authorization error. + + + + + + + Could not complete authorization due to an internal problem. + + + + + + + Customer has no AdWords account. + + + + + + + User doesn't have permission to access customer. + + + + + + + Effective user doesn't have permission to access this customer. + + + + + + + Access denied since the customer is not active. + + + + + + + User has read-only permission cannot mutate. + + + + + + + No customer found. + + + + + + + Developer doesn't have permission to access service. + + + + + + + + + Enums for the various reasons an error can be thrown as a result of + ClientTerms violation. + + + + + + + Customer has not agreed to the latest AdWords Terms & Conditions + + + + + + + + + The reasons for the target error. + + + + + + + + + + + The types of criteria. + + + + + + + Content label for exclusion. + + + + + + + Keyword. e.g. 'mars cruise' + + + + + + + Placement. aka Website. e.g. 'www.flowers4sale.com' + + + + + + + Vertical, e.g. 'category::Animals>Pets' This is for vertical targeting on the content + network. + + + + + + + User lists, are links to sets of users defined by the advertiser. + + + + + + + User interests, categories of interests the user is interested in. + + + + + + + Mobile applications to target. + + + + + + + Mobile application categories to target. + + + + + + + Product partition (product group) in a shopping campaign. + + + + + + + IP addresses to exclude. + + + + + + + Webpages of an advertiser's website to target. + + + + + + + Languages to target. + + + + + + + Geographic regions to target. + + + + + + + Age Range to exclude. + + + + + + + Mobile carriers to target. + + + + + + + Mobile operating system versions to target. + + + + + + + Mobile devices to target. + + + + + + + Gender to exclude. + + + + + + + Parent to target and exclude. + + + + + + + Proximity (area within a radius) to target. + + + + + + + Platforms to target. + + + + + + + Representing preferred content bid modifier. + + + + + + + AdSchedule or specific days and time intervals to target. + + + + + + + Targeting based on location groups. + + + + + + + Scope of products. Contains a list of product dimensions, all of which a product has to match + to be included in the campaign. + + + + + + + YouTube video to target. + + + + + + + YouTube channel to target. + + + + + + + Enables advertisers to target paid apps. + + + + + + + Income range to target and exclude. + + + + + + + Interaction type to bid modify. + + + + + + + <span class="constraint Rejected">Used for return value only. An enumeration could not be processed, typically due to incompatibility with your WSDL version.</span> + + + + + + + + + The reasons for the database error. + + + + + + + A concurrency problem occurred as two threads were attempting to modify same object. + + + + + + + The permission was denied to access an object. + + + + + + + The user's access to an object has been prohibited. + + + + + + + Requested campaign belongs to a product that is not supported by the api. + + + + + + + a duplicate key was detected upon insertion + + + + + + + a database error has occurred + + + + + + + an unknown error has occurred + + + + + + + + + The reasons for the target error. + + + + + + + Given field values do not correspond to a valid date. + + + + + + + Given field values do not correspond to a valid date time. + + + + + + + The string date's format should be yyyymmdd. + + + + + + + The string date range's format should be yyyymmdd yyyymmdd. + + + + + + + The string date time's format should be yyyymmdd hhmmss [tz]. + + + + + + + Date is before allowed minimum. + + + + + + + Date is after allowed maximum. + + + + + + + Date range bounds are not in order. + + + + + + + Both dates in range are null. + + + + + + + + + The reasons for the validation error. + + + + + + + + + + + + + User did not have read access. + + + + + + + User did not have write access. + + + + + + + + + + + The specified id refered to an entity which either doesn't exist or is not accessible to the + customer. e.g. campaign belongs to another customer. + + + + + + + + + The reasons for the target error. + + + + + + + Id not found + + + + + + + + + The single reason for the internal API error. + + + + + + + API encountered an unexpected internal error. + + + + + + + A temporary error occurred during the request. Please retry. + + + + + + + The cause of the error is not known or only defined in newer versions. + + + + + + + The API is currently unavailable for a planned downtime. + + + + + + + Mutate succeeded but server was unable to build response. Client should not retry mutate. + + + + + + + + + Match type of a keyword. i.e. the way we match a keyword string with + search queries. + + + + + + + Exact match + + + + + + + Phrase match + + + + + + + Broad match + + + + + + + + + Enum that represents the different Targeting Status values for a Location criterion. + + + + + + + The location is active. + + + + + + + The location is not available for targeting. + + + + + + + The location is phasing out, it will marked obsolete soon. + + + + + + + + + The reasons for the validation error. + + + + + + + + + + The reasons for the validation error. + + + + + + + Specified list/container must not contain any null elements + + + + + + + + + The reasons for the operation access error. + + + + + + + Unauthorized invocation of a service's method (get, mutate, etc.) + + + + + + + Unauthorized ADD operation in invoking a service's mutate method. + + + + + + + Unauthorized REMOVE operation in invoking a service's mutate method. + + + + + + + Unauthorized SET operation in invoking a service's mutate method. + + + + + + + A mutate action is not allowed on this campaign, from this client. + + + + + + + This operation is not permitted on this campaign type + + + + + + + An ADD operation may not set status to REMOVED. + + + + + + + This operation is not allowed because the campaign or adgroup is removed. + + + + + + + This operation is not permitted on this ad group type. + + + + + + + The reason the invoked method or operation is prohibited is not known + (the client may be of an older version than the server). + + + + + + + + + The reasons for the validation error. + + + + + + + + + + Enums for all the reasons an error can be thrown to the user during + billing quota checks. + + + + + + + Customer passed in an invalid token in the header. + + + + + + + Customer is marked delinquent. + + + + + + + Customer is a fraudulent. + + + + + + + Inactive Account. + + + + + + + Signup not complete + + + + + + + Developer token is not approved for production access, and the customer + is attempting to access a production account. + + + + + + + Terms and conditions are not signed. + + + + + + + Monthly budget quota reached. + + + + + + + Monthly budget quota exceeded. + + + + + + + + + The reasons for the target error. + + + + + + + + + + + The reason for the rate exceeded error. + + + + + + + Rate exceeded. + + + + + + + + + The reasons for the target error. + + + + + + + + + + The reasons for the validation error. + + + + + + + + + + The reasons for the target error. + + + + + + + Unknown value encountered + + + + + + + + + + + Error reason is unknown. + + + + + + + Invalid input. + + + + + + + The api version in the request has been discontinued. Please update + to the new AdWords API version. + + + + + + + + + The reasons for the target error. + + + + + + + Missing required field. + + + + + + + + + The reasons for Ad Scheduling errors. + + + + + + + The number of entries in the request exceeds the system limit. + + + + + + + The number of entries in the response exceeds the system limit. + + + + + + + The account is too large to load. + + + + + + + <span class="constraint Rejected">Used for return value only. An enumeration could not be processed, typically due to incompatibility with your WSDL version.</span> + + + + + + + + + The reasons for the target error. + + + + + + + + The input string value contains disallowed characters. + + + + + + + The input string value is invalid for the associated field. + + + + + + + + + The reasons for the target error. + + + + + + + + + + + Membership status of the user list. + + + + + + + Open status - list is accruing members and can be targeted to. + + + + + + + Closed status - No new members being added. Can not be used for targeting a new campaign. + Existing campaigns can still work as long as the list is not removed as a targeting criteria. + + + + + + + + + + + + + + + + + Represents the estimate results for a single ad group. + + + + + + + + + The adGroupId of the ad group specified in the request. + + This will be <code>null</code> for new ad groups. + + + + + + + The estimates for the keywords specified in the request. + + The list of estimates are returned in the same order as the keywords that + were sent in the request. + + + + + + + + + + + Represents an ad group that will be estimated. Ad groups may be all + new or all existing, or a mixture of new and existing. Only existing + campaigns can contain estimates for existing ad groups.<p> + + <p>To make a keyword estimates request in which estimates do not consider + existing account information (e.g. historical ad group performance), set both + {@link #adGroupId} and the enclosing {@link CampaignEstimateRequest}'s + {@code campaignId} to {@code null}. + + <p>For more details on usage, refer to document at + {@link CampaignEstimateRequest}. + + + + + + + + + The adGroupId for an ad group that belongs to the containing campaign from + {@link CampaignEstimateRequest} or {@code null}. + + <p>For usage, refer to document from {@link CampaignEstimateRequest}. + + + + + + + The keywords to estimate. + <span class="constraint ContentsDistinct">This field must contain distinct elements.</span> + <span class="constraint ContentsNotNull">This field must not contain {@code null} elements.</span> + <span class="constraint Required">This field is required and should not be {@code null}.</span> + + + + + + + The max CPC bid to use for estimates for this ad group. + + <p>This value overrides the max CPC of AdGroup specified by + {@link #adGroupId}. + + + + + + + + + + + Represents the estimate results for a single campaign. + + + + + + + + + The campaignId of the campaign specified in the request. + + This will be <code>null</code> for new campaigns. + + + + + + + The estimates for the ad groups belonging to this campaign in the request. + + They will be returned in the same order that they were sent in the request. + + + + + + + Traffic estimates segmented by platform for this campaign. + + + + + + + + + + + Represents a campaign that will be estimated.<p> + + Returns traffic estimates for the requested set of campaigns. + The campaigns can be all new or all existing, or a mixture of + new and existing. Only existing campaigns may contain estimates for existing + ad groups.<p> + + For existing campaigns, the campaign and optionally the ad group will be + used as context to produce more accurate estimates. Traffic estimates may + only be requested on keywords, so regardless of whether campaign and ad group + IDs are provided or left blank, at least one keyword is required to estimate + traffic.<p> + + To make a keyword estimates request in which estimates do not consider + existing account information (e.g. historical ad group performance), set + {@link #campaignId} to {@code null}. + + + + + + + + + The campaignId of an existing campaign or {@code null}.<p> + + Refer to the {@link CampaignEstimateRequest} documentation for + detailed usage. + + + + + + + The list of ad groups to estimate. This field is required and should not be {@code null}. At + least one ad group is required. + + <p>New campaigns may only contain new ad groups. If an + {@link AdGroupEstimateRequest} has an adGroupId but the campaign is new, + the API will return an error. + <span class="constraint ContentsNotNull">This field must not contain {@code null} elements.</span> + + + + + + + A list of {@link Criterion}s to be used for this Campaign. Criteria + provide information about geographical and language targeting. + + <p>Values in this field override the current targets in the Campaign + specified by {@link #campaignId} by the following mechanism: + + <p>This field accepts two types of {@link Criterion}s: {@link Location}, which should contain + all geographic targeting and {@link Language}, which should contain all language targeting. + If {@link Location}s are passed in, all geographic targeting in the campaign will be + overridden. If any {@link Language}s are passed in, all language targeting in the campaign + will be overridden. + + <p>If multiple {@link Location}s are specified, the traffic estimate will + be the sum of the estimates for each targeted area. This means that if + criteria are chosen which overlap each other (for example, targeting both + a country and a city within that country), the traffic estimate will be + be larger than if no overlap were present - i. e., the overlap region will + be double-counted in the estimate. + + <p>If no criteria are specified and this is for a new campaign then it + will default to all languages in all countries and territories, and + Google search. + + <p>If no criteria are specified and this is for an existing campaign + then the current targeting on that campaign will be used. + + <p>While there's no solid limit on number of criteria, + TrafficEstimatorService may return error with TOO_MANY_TARGETS if the + request contains too many criteria across all + {@link CampaignEstimateRequest}s in a {@link TrafficEstimatorSelector}. + + <p>Supported Criteria : {@link Language} and {@link Location}. + <span class="constraint ContentsDistinct">This field must contain distinct elements.</span> + <span class="constraint ContentsNotNull">This field must not contain {@code null} elements.</span> + + + + + + + A {@link NetworkSetting} to be used for this Campaign. The value of this + field overrides the current targets in the Campaign specified by + {@link #campaignId}. + + <p>For non Google partner accounts, only + {@link NetworkSetting#targetGoogleSearch} and + {@link NetworkSetting#targetSearchNetwork} are supported, they may be + combined to sum the estimates. + + <p>For some Google partner accounts, in addition + {@link NetworkSetting#getTargetPartnerSearchNetwork} is supported. + + <p>If all request network settings and Campaign's network settings are + empty, the default is {@link NetworkSetting#targetGoogleSearch}. + + + + + + + Daily campaign budget to use in traffic estimation. If not specified, + the daily budget is unlimited. + + + + + + + + + + + Errors for currency codes. + + + + + + + + + The error reason represented by an enum. + + + + + + + + + + + Abstract class representing an reply to an {@link EstimateRequest}. + + + + + + + Indicates that this instance is a subtype of Estimate. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Abstract class representing a request to estimate stats. + + + + + + + Indicates that this instance is a subtype of EstimateRequest. + Although this field is returned in the response, it is ignored on input + and cannot be selected. Specify xsi:type instead. + + + + + + + + + Represents the traffic estimate result for a single keyword. + + + + + + + + + The existing criterionId for this keyword, if any. + + This will not be returned if this is a new keyword. + + + + + + + The lower bound on the estimated stats. + + <p>This is not a guarantee that actual performance will never be lower than + these stats. + + + + + + + The upper bound on the estimated stats. + + <p>This is not a guarantee that actual performance will never be higher than + these stats. + + + + + + + + + + + Represents a keyword to be estimated. + + + + + + + + + The {@link Keyword} to estimate. The keyword text is required regardless + of whether the keyword ID is included. The keyword ID is optional and has + the following characteristics: + <ul> + <li>When omitted, the ID indicates a new keyword to be estimated.</li> + <li>When present with a campaign and ad group also specified, the ID should + be for an existing keyword in the ad group. This can improve the estimates + since historical performance is known.</li> + <li>When present without a campaign and ad group specified, the ID is + ignored.</li> + </ul> + <span class="constraint Required">This field is required and should not be {@code null}.</span> + + + + + + + The max CPC bid for this keyword. + + In general, the {@code maxCpc} of a {@link KeywordEstimateRequest} is + optional, since there is usually another {@code maxCpc} that can be used, + such as the {@code maxCpc} on an existing keyword, an existing or + overriding {@code maxCpc} of containing {@link AdGroupEstimateRequest}. + However, if there is no backup value of {@code maxCpc} anywhere along the + line, you must provide a value for {@code maxCpc} in + {@link KeywordEstimateRequest}. This would happen, for example, if the + {@link KeywordEstimateRequest} is for a new keyword. + + + + + + + Whether the keyword is negative or not. The default value is false. + If negative, no current ad group ads will appear for searches containing + this keyword.<p> + + The estimate for negative keywords should reflect no traffic and zero CPC, + but including a negative keyword will affect the other estimates in the + request. + + + + + + + + + + + Contains a campaign level estimate for a specified {@link Platform}. + + + + + + + The {@link Platform} associated with this estimate. + <span class="constraint Required">This field is required and should not be {@code null}.</span> + + + + + + + Minimum estimate for the specified {@link Platform}. + + + + + + + Maximum estimate for the specified {@link Platform}. + + + + + + + + + Represents a set of stats for a daily traffic estimate. + + <p>{@code averageCpc}, {@code averagePosition} and {@code clickThroughRate} will be + {@code null} when not defined and {@code clicksPerDay} or {@code impressionsPerDay} + is {@code 0}, respectively.</p> + + + + + + + The estimated average CPC. + + + + + + + The estimated average position. + + + + + + + The estimated click through rate. + + + + + + + The estimated number of clicks, in floating point representation. + + + + + + + The estimated number of impressions, in floating point representation. + + + + + + + The estimated total cost. + + + + + + + + + Base error class for {@link TrafficEstimatorService}. + + + + + + + + + + + + + + Contains results of traffic estimation request. + + + + + + + The estimates for the campaigns specified in the request. + + They are listed in the same order as the campaigns that were sent in the + request. + + + + + + + + + Contains a list of campaigns to perform a traffic estimate on. + + + + + + + A list of all campaigns to estimate.<p> + + To create a Keyword estimates request, use {@code null} campaign id. + <span class="constraint CollectionSize">The maximum size of this collection is 5.</span> + <span class="constraint ContentsDistinct">This field must contain distinct elements.</span> + <span class="constraint ContentsNotNull">This field must not contain {@code null} elements.</span> + <span class="constraint NotEmpty">This field must contain at least one element.</span> + <span class="constraint Required">This field is required and should not be {@code null}.</span> + + + + + + + To request a list of campaign level estimates segmented by platform. + + + + + + + + + Encodes the reason (cause) of a particular {@link CurrencyCodeError}. + + + + + + + + + + + + When the request with {@code null} campaign ID in {@link CampaignEstimateRequest} contains an + {@link AdGroupEstimateRequest} with an ID. + + + + + + + When the request with {@code null} adgroup ID in {@link AdGroupEstimateRequest} contains a + {@link KeywordEstimateRequest} with an ID. + + + + + + + All {@link KeywordEstimateRequest} items should have maxCpc associated with them. + + + + + + + When there are more {@link KeywordEstimateRequest}s in the request than + TrafficEstimatorService allows. + + + + + + + When there are more {@link CampaignEstimateRequest}s in the request than + TrafficEstimatorService allows. + + + + + + + When there are more {@link AdGroupEstimateRequest}s in the request than + TrafficEstimatorService allows. + + + + + + + When there are more targets in the request than TrafficEstimatorService allows. See + documentation on {@link CampaignEstimateRequest} for more information about this error. + + + + + + + Request contains a keyword that is too long for backends to handle. + + + + + + + Request contains a keyword that contains broad match modifiers. + + + + + + + When an unexpected error occurs. + + + + + + + When backend service calls fail. + + + + + + + + + Returns traffic estimates for specified criteria. + + @param selector Campaigns, ad groups and keywords for which traffic + should be estimated. + @return Traffic estimation results. + @throws ApiException if problems occurred while retrieving estimates + + + + + + + + <span class="constraint Required">This field is required and should not be {@code null}.</span> + + + + + + + + + + + + + + + + + A fault element of type ApiException. + + + + + + + + + + + + + + + + + + + + + + + + + Use this service to request traffic estimates for proposed or existing campaigns, ad + groups, and keywords. + + <p> + To simply retrieve estimates for a list of proposed keywords, create a + {@linkplain CampaignEstimateRequest campaign estimate request} and a child + {@linkplain AdGroupEstimateRequest ad group estimate request} with {@code null} IDs, + and then set the + {@link AdGroupEstimateRequest#keywordEstimateRequests keywordEstimateRequests} + to contain the keywords.</p> + + <p>You can refine the traffic estimates by setting + {@linkplain CampaignEstimateRequest#targets campaign targeting options} in the request. + If an ad group ID is provided, all creatives from that ad group will be loaded and used + to improve estimates.</p> + + <p>The maximum number of {@linkplain KeywordEstimateRequest keyword estimate + requests} across all campaign estimate requests and + ad group estimate requests is 2500.</p> + + <p>The maximum number of {@linkplain AdGroupEstimateRequest adgroup estimate + requests} across all campaign estimate requests is 50.</p> + + <p>Note that the API returns intervals whereas the Traffic Estimator UI displays averages. + Estimates are account specific since they are based on creatives already in the account. + When comparing numbers, use the same account for the API and UI.</p> + <span class="constraint AdxEnabled">This is disabled for AdX.</span> + + + + Returns traffic estimates for specified criteria. + + @param selector Campaigns, ad groups and keywords for which traffic + should be estimated. + @return Traffic estimation results. + @throws ApiException if problems occurred while retrieving estimates + + + + + + + + + + + + + + + + + + + + + + + + + + + + +