ValueError: Specified type 'DismissRecommendationOperation' does not exist in Google Ads API v7

56 views
Skip to first unread message

Sean Driscoll

unread,
May 5, 2021, 6:30:22 PM5/5/21
to AdWords API and Google Ads API Forum
Hi, 

I'm trying to dismiss some recommendations via the Google Ads API, following the example on this page https://developers.google.com/google-ads/api/docs/recommendations but I'm getting a value error saying the specified type doesn't exist. Any help would be appreciated. Code is below

def main(client, customer_id, recommendation_id):
    recommendation_service = client.get_service("RecommendationService")

     dismiss_recommendation_operation=
client.get_type("DismissRecommendationOperation")

    dismiss_recommendation_operation.resource_name = (
    recommendation_service.recommendation_path(
    customer_id, recommendation_id)
)

recommendation_response = recommendation_service.dismiss_recommendation(
customer_id=customer_id, operations=[dismiss_recommendation_operation]
)

print(
"Dismissed recommendation with resource name: "
f"'{recommendation_response.results[0].resource_name}'"
)

Google Ads API Forum Advisor Prod

unread,
May 5, 2021, 9:45:17 PM5/5/21
to se...@bpmms.com, adwor...@googlegroups.com
Hi Sean,

Thank you for posting your concern.

Based on this document, the code structure is similar to applying a recommendation, but instead you use DismissRecommendationOperation and RecommendationService.DismissRecommendation. I can see that the implementation of your code is correct based on the said guide. However, since you are experiencing error with Python code, I would suggest reaching out to the author of the Python client library via this link. The author of the Python client library is more equipped to provide support with the issues / concerns related to the said client library. With this, they can also assist you on the correct implementation of the code for dismissing proposal.

Regards,
Google Logo
Ernie John Blanca Tacata
Google Ads API Team
 


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