Interacting with Google Ads in an idempotent way.

103 views
Skip to first unread message

Ben Johnson

unread,
May 15, 2019, 5:43:03 PM5/15/19
to AdWords API and Google Ads API Forum
Hello,

I have a more general design question for making changes to a Google Ads account through the API.

Does anyone have any advice on how to retry sweeping account changes or write code that interacts with the API in an idempotent way?

For example, if I was trying to create several campaigns and ad groups, I can batch up the create operations into two api requests (one for executing all the create campaign operations and one for all the create ad group operations). However, if something goes wrong in the middle of creating ad groups, as far as I can tell there is no way to easily re-run these changes in an idempotent way because the campaigns have already been created and I cannot recreate campaigns with the same names (even after removing the old campaigns, the names must be unique among all removed and active campaigns).

The closest thing I can think is to check (before every create operation) if an object already exists with a similar name, and if so, skip creating the new object. However, this would require an API call to check on Google Ads for the existence of an object for every creation operation and would kind of mute the entire point of batching create operations into one API request.

Would be nice to have COMMIT and ROLLBACK operations in the API.

Advice?

googleadsapi...@google.com

unread,
May 16, 2019, 3:15:30 AM5/16/19
to AdWords API and Google Ads API Forum
Hi Ben,

Thank you for reaching out. I would suggest you to check out this sample code on how you could handle partial failures. For partial failures, all failed requests will be recorded while all successful requests will pass through. This said, you could just run the batch operation again excluding the ones that are successful.

Let me know if this helps. Feel free to write back if you have further clarifications.

Regards,
Dave
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/7f90b95d-dc11-41dc-8950-2049f4223fae%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages