Trouble getting partial failures

125 views
Skip to first unread message

Walter Bodwell

unread,
Apr 7, 2022, 2:30:07 PM4/7/22
to Google Ads API and AdWords API Forum
I'm uploading offline conversions.  Most are successful (and I can see them in the Google Ads UI).  Some are not.  I'm having difficulty getting an error message for the unsuccessful ones.

Here's my Python code:

# create conversion
click_conversion = client.get_type("ClickConversion")
click_conversion.conversion_action = conversion_action
click_conversion.gclid = click_id
if conversion_value is not None:
    click_conversion.conversion_value = float(conversion_value)
click_conversion.conversion_date_time = conversion_time
click_conversion.currency_code = conversion_currency_code

# upload conversion
conversion_upload_service = client.get_service("ConversionUploadService")
request = client.get_type("UploadClickConversionsRequest")
request.customer_id = customer_id
request.conversions.append(click_conversion)
request.partial_failure = True
offline_conversion_responses = conversion_upload_service.upload_click_conversions(request=request).results

# process response
for response in offline_conversion_responses:
    partial_failure = getattr(response, "partial_failure_error", None)
    code = getattr(partial_failure, "code", None)
    if code != 0:
        error_details = getattr(partial_failure, "details", [])
        errors = []
        for error_detail in error_details:
            failure_message = client.get_type("GoogleAdsFailure")
            GoogleAdsFailure = type(failure_message)
            failure_object = GoogleAdsFailure.deserialize(error_detail.value)
            for error in failure_object.errors:
                errors.append(error.message)
        error_message = 'Unknown Error' if len(errors) == 0 else '; '.join(errors)

The problem is partial_failure always seems to be None regardless of whether it was successful.

Any suggestions?

Thanks,
Walter

Google Ads API Forum Advisor

unread,
Apr 7, 2022, 10:15:34 PM4/7/22
to wbod...@ftoptimize.com, adwor...@googlegroups.com
Hi Walter,

Thank you for raising this concern to the Google Ads API team.

Moving forward to your concern, as per this document, in Python the partial_failure_error attr is always present on a response message and is represented by a google.rpc.Status message. So we can't simply check whether the field is present, we must check that the code is non-zero.

Let us know if this is what you're looking for.

Regards,
Google Logo
Carmela
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZKslq:ref

Walter Bodwell

unread,
Apr 11, 2022, 9:36:31 AM4/11/22
to Google Ads API and AdWords API Forum
Thanks for your response.  I am checking the code after getting the partial_failure_error.   The problem is that the partial_failure_error is None (i.e., not present).

Thanks,
Walter

Google Ads API Forum Advisor

unread,
Apr 11, 2022, 11:00:26 PM4/11/22
to wbod...@ftoptimize.com, adwor...@googlegroups.com
Hi Walter,

Thank you for the reply. I am also a member of the Google Ads API team and let me provide support to your concern.

To take a closer look at the issue, could you provide the complete request and response logs with request ID and request header generated on your end? This information can be extracted when logging of API transactions is enabled on your end. If not, then you can follow this guide for the Python client library.

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.

Regards,
Google Logo
Ernie John
Google Ads API Team
 


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