Recommendations from API Always return Empty

32 views
Skip to first unread message

Dev

unread,
May 14, 2024, 9:23:59 AM5/14/24
to Google Ads API and AdWords API Forum
I found that the Recommendations result from Google Ads API always returns empty while on my dashboard I could see some recommendations are exists.

This is my python code:
```
from google.ads.googleads.client import GoogleAdsClient

customer_id = "<redacted>"

credentials = {
"developer_token": "<redacted>",
"refresh_token": "<redacted>",
"client_id": "<redacted>",
"client_secret": "<redacted>",
"use_proto_plus": True,
"login_customer_id": "<redacted>",
}


print(f"Initializing Google Ads Client...")

client = GoogleAdsClient.load_from_dict(
credentials
)

googleads_service = client.get_service("GoogleAdsService")
query = f"""
SELECT
recommendation.campaign,
recommendation.resource_name
FROM recommendation"""

# Detects keyword recommendations that exist for the customer account.
response = googleads_service.search(customer_id=customer_id, query=query)

print(f"Recommendation Results: {response.results}")
```
Results:
Screen Shot 2024-05-13 at 14.17.34.png
From my dashboard:
Screen Shot 2024-05-13 at 14.16.17.png

Google Ads API Forum Advisor

unread,
May 14, 2024, 10:24:53 AM5/14/24
to d...@play3.gg, adwor...@googlegroups.com
Hi,

Thank you for reaching out to the Google Ads API support team.

On my end, I am unable to replicate the issue. The same query is running successfully for me, and results are being returned.

After verifying the provided code, I could see that you have redacted the credentials customer ID and login customer ID. In order to replicate the issue from our end, provide us with the uncropped screenshot of the Google Ads account where the recommendations are showing complete API logs (request and response with request-id and request header) generated at your end.

If you are using a client library and haven't enabled the logging yet, I would request you to enable logging for the specific client library that you are using. You can refer to the guides Java.NetPHPPythonRuby or Perl to enable logging at your end. For REST interface requests, you can enable logging via the curl command by using the -i flag.

You can send the details via Reply privately to the author option, or direct private reply to this email.
 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tIyB9:ref" (ADR-00234930)

Thanks,
 
Google Logo Google Ads API Team


Reply all
Reply to author
Forward
0 new messages