Request: Expose Required Union Fields In Error Response

153 views
Skip to first unread message

Pete Lavetsky (AdWords API Guru)

unread,
Feb 23, 2022, 9:39:26 AM2/23/22
to Google Ads API and AdWords API Forum
When mutating a resource that contains a union field, if there is a missing required field on the union field data, that required field name is not returned in the error message.

This masks what the actual error is and what field is required.

In my example below, attempting to create a Responsive Display Ad fails because a required field is missing from the ad_data union field. Which field is missing is not returned to the user in the error message.

request-id=zKmpiwHTBsCVrlE8bqiZbg

Request
-------
MethodName: google.ads.googleads.v10.services.AdGroupAdService/MutateAdGroupAds
Endpoint: googleads.googleapis.com:443
Headers: {developer-token=REDACTED, login-customer-id=ABC, x-goog-api-client=gl-java/11.0.13 gccl/17.0.1 gapic/17.0.1 gax/2.6.1 grpc/1.41.0}
Body: customer_id: "XYZ"
operations {
  create {
    status: ENABLED
    ad {
      type: RESPONSIVE_DISPLAY_AD
      responsive_display_ad {
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        square_marketing_images {
          asset: "customers/ABC/assets/XYZ"
        }
        headlines {
          text: removed
          }
          headlines {
            text: removed
          }
          headlines {
            text: removed
          }
          headlines {
            text: removed
          }
          descriptions {
            text: removed
          }
          descriptions {
            text: removed
          }
          descriptions {
            text: removedAmenity Space."
          }
          format_setting: ALL_FORMATS
          business_name: removed
          allow_flexible_color: true
        }
        final_urls: removed
      }
      ad_group: "customers/ABC/adGroups/XYZ"
    }
  }
  partial_failure: true

Response
  --------
  Headers: Metadata(content-disposition=attachment,content-type=application/grpc,request-id=zKmpiwHTBsCVrlE8bqiZbg,date=Tue, 22 Feb 2022 15:15:06 GMT,alt-svc=h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43")
  Body: results {
  }
  partial_failure_error {
    code: 3
    message: "The required field was not present., at operations[0].create.ad.responsive_display_ad"
    details {
      type_url: "type.googleapis.com/google.ads.googleads.v10.errors.GoogleAdsFailure"
      value: "\ne\n\003\350\003\002\022#The required field was not present.\"9\022\016\n\noperations\030\000\022\b\n\006create\022\004\n\002ad\022\027\n\025responsive_display_ad"
    }
  }

  Failure message: null
  Status: Status{code=OK, description=null, cause=null}.


As you can see, we are told that "The required field was not present" in the error response, but we are not told which field is missing.

Pete

Google Ads API Forum Advisor

unread,
Feb 23, 2022, 5:01:38 PM2/23/22
to pete.l...@gmail.com, adwor...@googlegroups.com
Hi Pete,

I reproduced this behavior when not setting the long headline, other fields showed the correct error. I raised this request with my team. This request is subject to review. You may monitor our blog for an update.

Regards,

Google Logo
Aryeh
Google Ads API Team
 


ref:_00D1U1174p._5004Q2WyLrw:ref

Google Ads API Forum Advisor

unread,
Feb 25, 2022, 3:14:05 PM2/25/22
to pete.l...@gmail.com, adwor...@googlegroups.com
Hi Pete,

My team is investigating this issue and we will get back to you on this thread as soon as possible.
Reply all
Reply to author
Forward
0 new messages