Adwords api Reports

32 views
Skip to first unread message

Lionel Joseph Tharsivse

unread,
Oct 21, 2021, 3:59:55 PM10/21/21
to AdWords API and Google Ads API Forum
Hello Team,
I am trying to query or retrieve reports from the googleAds api such as geo_perfromance_report, keywords_performance_report using the newest version, so far Im unsuccessful in retrieving them.
this is one of the error that i
get IsFault: True, FaultMessage: Error in GEO_PERFORMANCE_REPORT:  is not a valid resource name.
any support or guidance is appreciated.

def main(client, customer_id):
start_date = datetime.today().date().isoformat().replace("-", "")
end_date = datetime.now() + timedelta(days=- 28)
end_date = end_date.date().isoformat().replace("-", "")
ga_service = client.get_service("GoogleAdsService")

query = """SELECT
segments.date
FROM GEO_PERFORMANCE_REPORT WHERE segments.date DURING LAST_7_DAYS
ORDER BY metrics.impressions DESC
LIMIT 50"""
stream = ga_service.search_stream(customer_id=customer_id, query=query)

for batch in stream:
for row in batch.results:
print(
f"Campaign with ID {row.Attribute.adGroupID} and name "
f'"{row.Attribute.adGroupID}" was found.'
)

if __name__ == "__main__":
# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.
googleads_client = GoogleAdsClient.load_from_storage(path="path", version="v8")

try:
main( googleads_client, "customer_id")
except GoogleAdsException as ex:
print(
f'Request with ID "{ex.request_id}" failed with status '
f'"{ex.error.code().name}" and includes the following errors:'
)
for error in ex.failure.errors:
print(f'\tError with message "{error.message}".')
if error.location:
for field_path_element in error.location.field_path_elements:
print(f"\t\tOn field: {field_path_element.field_name}")
sys.exit(1)
Message has been deleted

Google Ads API Forum Advisor

unread,
Oct 22, 2021, 6:14:55 AM10/22/21
to adwor...@googlegroups.com, l.tha...@sevensenders.com

Hi Lionel,

 

I'm Kevin from the Google Ads API team. I'll try my best to assist you.

 

It seems that you might be using Google Ads API rather than AdWords API. Can you please clarify which one are you trying to use exactly? If you would like to use Google Ads API, you can check this link for an overview of how reports works in Google Ads API as well as the list of all resources. I also suggest that you check this example for further reference. If you're still having issues, please provide the complete request and response logs with request ID so I can further investigate. You can send these to me via Reply privately to author option or send it to googleadsa...@google.com

 

Regards,

Google Logo
Kevin Gil Soriano
Google Ads API Team
 


ref:_00D1U1174p._5004Q2QED8P:ref
Reply all
Reply to author
Forward
0 new messages