Hi Suresh,
Thank you for writing to us. With regards to your concern, you are right and you should be receiving an empty response while getting the recommendations for your ads in the test accounts. Can you please confirm if you observing any timeout or bad request error while making this call against your account? If yes, could you please elaborate more on the error message received? If not, could you please share the request and response logs along with client customer id privately for me to assist you better? Please use Reply privately to author option while sharing the details.
Regards,
Nikisha Patel, Google Ads API Team
ListAccessibleCustomersResponse response = |
customerService.listAccessibleCustomers( |
Hi Suresh,
Thank you for sharing the client customer id. I took a closer look into your account and found that you are trying to making the API call against your test manager account. Could you please try making the API request call to get the text ads recommendation against the client customer account and let me know if you are still having any issues? For your other concern related to ListAccessibleCustomers, this service returns the list of customers based on your OAuth credentials and the accounts that you are able to act upon directly with your current credentials. Could you please confirm the OAuth credentials are generated using the email address having direct access to the accounts? If yes, could you please share the email address privately for me to investigate this further on my end?
Regards,
Nikisha Patel, Google Ads API Team
#!/usr/bin/env python
# Copyright 2018 Google LLC
#
# 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
#
# https://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 illustrates how to get all campaigns.
To add campaigns, run add_campaigns.py.
"""
from __future__ import absolute_import
import argparse
import six
import sys
import google.ads.google_ads.client
_DEFAULT_PAGE_SIZE = 1000
customer_id="xxx-xxx-xxxx"
def main(client, customer_id, page_size):
ga_service = client.get_service('GoogleAdsService', version='v2')
query = ('SELECT campaign.id FROM campaign ORDER BY campaign.id')
results = ga_service.search(customer_id, query=query, page_size=page_size)
try:
for row in results:
print('Campaign with ID %d and name "%s" was found.'
% (row.campaign.id.value))
except google.ads.google_ads.errors.GoogleAdsException as ex:
print('Request with ID "%s" failed with status "%s" and includes the '
'following errors:' % (ex.request_id, ex.error.code().name))
for error in ex.failure.errors:
print('\tError with message "%s".' % error.message)
if error.location:
for field_path_element in error.location.field_path_elements:
print('\t\tOn field: %s' % field_path_element.field_name)
sys.exit(1)
if __name__ == '__main__':
# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.
google_ads_client = GoogleAdsClient.load_from_storage(path='E:/Work/AWAPI/venv/google-ads.yaml')
parser = argparse.ArgumentParser(
description='Lists all campaigns for specified customer.')
# The following argument(s) should be provided to run the example.
parser.add_argument('-c', '--customer_id', type=six.text_type,
required=True, help='The Google Ads customer ID.')
args = parser.parse_args()
main(google_ads_client, args.customer_id, _DEFAULT_PAGE_SIZE)
Hi Kera,
Thank you for writing to us. To assist you better, could you please share the complete request and response logs along with the client customer against which you are making the API request call to get the campaign details? Please use Reply privately to author option while sharing the details.
Regards,
Nikisha Patel, Google Ads API Team