wrong expected behaviour with validate only

112 views
Skip to first unread message

benj...@effilab-local.com

unread,
Apr 23, 2019, 4:57:01 PM4/23/19
to AdWords API and Google Ads API Forum
I am using google ads and I checked how the api is behaving with wrong data: there can be sync issues and its super important to ensure it is safe enough.

I was disappointed to see that even if I am using validate_only set to true, the api is sending an exception whenever I send a wrong resource path.

I would have expected validation errors for the wrong operation.

Here are the logs:
W, [2019-04-23T22:48:48.724065 #608]  WARN -- : CID: 1342647521, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v1.services.ExtensionFeedItemService/MutateExtensionFeedItems, IsFault: yes
I, [2019-04-23T22:48:48.725862 #608]  INFO -- : Outgoing request: Headers: {"x-goog-api-client":"gl-ruby/2.5.1 gapic/1.1.1 gax/1.5.0 grpc/1.19.0","developer-token":"SANITIZED","login-customer-id":"SANITIZED"} Payload: {"customerId":"SANITIZED","operations":[{"update":{"resourceName":"customers/1342647521/extensionFeedItems/117","sitelinkFeedItem":{"linkText":"Link text 2","line1":"updated 2","line2":"desc_line2-2","finalUrls":["http://www.effilab.com/link/path/2"]}},"updateMask":"sitelinkFeedItem.linkText,sitelinkFeedItem.line1,sitelinkFeedItem.line2,sitelinkFeedItem.finalUrls"},{"create":{"sitelinkFeedItem":{"linkText":"Link text 4","line1":"desc_line1-4","line2":"desc_line2-4","finalUrls":["http://www.effilab.com/link/path/4"]}}}],"validateOnly":true}
I, [2019-04-23T22:48:48.727453 #608]  INFO -- : Incoming response (errors):
Error 1: {"errorCode":{"mutateError":"RESOURCE_NOT_FOUND"},"message":"Resource was not found.","trigger":{"stringValue":""},"location":{"fieldPathElements":[{"fieldName":"operations","index":},{"fieldName":"update"},{"fieldName":"resource_name"}]}}

What do you think?

benj...@effilab-local.com

unread,
Apr 23, 2019, 5:00:27 PM4/23/19
to AdWords API and Google Ads API Forum
another example if I try to delete an already deleted feed item:

W, [2019-04-23T22:59:27.857363 #625]  WARN -- : CID: 1342647521, Host: googleads.googleapis.com:443, Method: /google.ads.googleads.v1.services.ExtensionFeedItemService/MutateExtensionFeedItems, IsFault: yes
I, [2019-04-23T22:59:27.859201 #625]  INFO -- : Outgoing request: Headers: {"x-goog-api-client":"gl-ruby/2.5.1 gapic/1.1.1 gax/1.5.0 grpc/1.19.0","developer-token":"SANITIZED","login-customer-id":"SANITIZED"} Payload: {"customerId":"SANITIZED","operations":[{"remove":"customers/1342647521/extensionFeedItems/69260980063"},{"create":{"sitelinkFeedItem":{"linkText":"Link text 3","line1":"desc_line1-3","line2":"desc_line2-3","finalUrls":["http://www.effilab.com/link/path/3"]}}}],"validateOnly":true}
I, [2019-04-23T22:59:27.860736 #625]  INFO -- : Incoming response (errors):
Error 1: {"errorCode":{"internalError":"ERROR_CODE_NOT_PUBLISHED"},"message":"The appropriate error code isn't part of the API yet.","trigger":{"stringValue":""},"location":{"fieldPathElements":[{"fieldName":"operations","index":},{"fieldName":"remove"}]},"details":{"unpublishedErrorCode":"ExtensionFeedItemError.CANNOT_OPERATE_ON_DELETED_FEED_ITEM"}}

googleadsapi...@google.com

unread,
Apr 24, 2019, 2:37:50 AM4/24/19
to AdWords API and Google Ads API Forum
Hi Benjamin,

Thank you for reaching out. Could you further elaborate what you wish to achieve with the validateOnly header in your requests? You can test using production data in a read-only fashion on your production accounts if you use the validateOnlyheader in your requests, and you have an approved developer token.

Upon checking your logs, the errors that you encountered were expected. For your first concern, you have to indicate a valid resource name in your ExtensionFeedItem. It appears that the feed item id provided does not exist. You can use the ExtensionFeedItemService.GetExtensionFeedItem to get the list of ExtensionFeedItems. As for your second concern, you cannot operate on deleted items, hence the error you are encountering. Kindly use an active sitelinkFeedItem instead.

Regards,
Dannison
Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
 
You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/b6ea6e9a-7508-4da2-be03-1db91862fa61%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

benj...@effilab-local.com

unread,
Apr 24, 2019, 3:57:22 AM4/24/19
to AdWords API and Google Ads API Forum
In the company I am working, we sync millions of entities, and sometimes errors happen, so it may happen we send twice a request to remove something for instance.

Using validate_only I would expect the request to fail gracefully: tell me which operations are valid, which are invalid and why. That way I can filter them out and decide what to do with errored cases.

In the current setup:
- it fails with an exception
- there is no indication of which operation was wrong

googleadsapi...@google.com

unread,
Apr 24, 2019, 6:10:08 PM4/24/19
to benj...@effilab-local.com, AdWords API and Google Ads API Forum
Hi Benjamin,

You mentioned that you expected validate_only = true to fail gracefully if there's an exception. Were you thinking of partial_failure instead? With validate only enabled, the API is expected to throw an exception if any of the operations have an error. The behavior you described is more in line with enabling partial failure, where the API applies successful operations, but then reports errors for individual operations that failed in the response. Please note, however, that ExtensionFeedItemService.mutate does not currently support partial failure.

All that being said, the error ERROR_CODE_NOT_PUBLISHED message is definitely something we need to look at. I've reported that to the feeds team for follow-up and will let you know when I hear back from them.

Thanks,
Josh, Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

benj...@effilab-local.com

unread,
Apr 24, 2019, 6:15:17 PM4/24/19
to AdWords API and Google Ads API Forum
I’d say ok for the exception but then I would like to have meaningful errors and their index.
If its only related to partial_failure, lets wait for the api to be consolidated and less brittle.

googleadsapi...@google.com

unread,
Apr 25, 2019, 10:11:28 AM4/25/19
to benj...@effilab-local.com, AdWords API and Google Ads API Forum
Hi,

I just realized that I may have misunderstood the issue with the error. Is the problem you're highlighting that it's missing the operation index?

Error 1: {"errorCode":{"mutateError":"RESOURCE_NOT_FOUND"},"message":"Resource was not found.","trigger":{"stringValue":""},"location":{"fieldPathElements":[{"fieldName":"operations","index":},{"fieldName":"update"},{"fieldName":"resource_name"}]}}

If so, could you confirm that you see this problem even if the operation index is not 0? Due to the way protocol buffers behave, you won't see a value for a primitive field such as index if the value is the default for that primitive type (zero, in this case).

Thanks,
Josh, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

On 04/24/19 18:15:17 benj...@effilab-local.com wrote:
I’d say ok for the exception but then I would like to have meaningful errors and their index.
If its only related to partial_failure, lets wait for the api to be consolidated and less brittle.

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
---
You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.

benj...@effilab-local.com

unread,
Apr 25, 2019, 10:17:48 AM4/25/19
to AdWords API and Google Ads API Forum
Exception is fine as long as I have data to process.

I would say its the api's library to provide with proper data despite buffer constraints.

I have not tested something though: what if entries at index 0 and 2 have bad data? Would I get all errors (which I would like) or only the first failing (which would be meaningless then)?

Thanks

googleadsapi...@google.com

unread,
Apr 25, 2019, 1:06:41 PM4/25/19
to benj...@effilab-local.com, AdWords API and Google Ads API Forum
Hi,

If your request contains errors at operation index 0 and operation index 2, then the response will return both errors. In addition, in logs you'll see an index value for the entry for operation 2 since that's not the default value for an int. Here's an example I put together:

message: "Field \'ad_group\' is required for \'CREATE\' operation."
location {
  field_path_elements {
    field_name: "operations"
    index {
    }
  }
  field_path_elements {
    field_name: "create"
  }
  field_path_elements {
    field_name: "ad_group"
  }
}

  Error 1: error_code {
  request_error: REQUIRED_FIELD_MISSING
}
message: "Field \'ad_group\' is required for \'CREATE\' operation."
location {
  field_path_elements {
    field_name: "operations"
    index {
      value: 2
    }
  }
  field_path_elements {
    field_name: "create"
  }
  field_path_elements {
    field_name: "ad_group"
  }
}

If you're using one of our client libraries, it should give you access to the GoogleAdsFailure and the underlying GoogleAdsErrors. If you can't find that in the library, please let me know which library you're using so I can help out.

Thanks,
Josh, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Reply all
Reply to author
Forward
0 new messages