Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
Jeśli musisz jednocześnie wykonywać operacje na różnych typach obiektów lub wolisz pisać kod pod kątem jednego punktu końcowego zamiast używać osobnego punktu końcowego dla każdego typu zasobu, możesz użyć punktu końcowego GoogleAdsService.Mutate
dla wszystkich obsługiwanych operacji zmiany.
mutate_operation1=client.operation(:Mutate)mutate_operation2=client.operation(:Mutate)campaign_operation=client.operation(:Campaign)ad_group_operation=client.operation(:AdGroup)# Do some setup here to get campaign_operation and ad_group_operation into the# state you would want them for a regular mutate call to their respective# services.mutate_operation1.campaign_operation=campaign_operationmutate_operation2.ad_group_operation=ad_group_operationgoogle_ads_service.mutate(customer_id,[mutate_operation1,mutate_operation2])
Podobnie jak inne usługi, ten punkt końcowy obsługuje częściowe niepowodzenie i tylko weryfikację.
[null,null,["Ostatnia aktualizacja: 2025-08-27 UTC."],[[["\u003cp\u003eUse the \u003ccode\u003eGoogleAdsService.Mutate\u003c/code\u003e endpoint to operate on different entity types or prefer a single endpoint.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMutateGoogleAdsRequest\u003c/code\u003e accepts multiple \u003ccode\u003eMutateOperation\u003c/code\u003e entities, each handling a single operation for one resource type.\u003c/p\u003e\n"],["\u003cp\u003eConstruct separate \u003ccode\u003eMutateOperation\u003c/code\u003e objects for each desired operation, like creating a campaign and an ad group, and pass them to \u003ccode\u003eGoogleAdsService\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThis endpoint supports partial failure handling and validate-only requests, similar to other Google Ads API services.\u003c/p\u003e\n"]]],[],null,["# Bulk Mutates\n\nIf you need to operate on different types of entities at the same time or\nprefer to write against a single endpoint rather than using a separate endpoint\nper resource type, then you can use the\n[`GoogleAdsService.Mutate`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Mutate)\nendpoint for all supported mutate operations.\n| **Note:** You can see the full list of supported operations on the reference page for [`MutateOperation`](/google-ads/api/reference/rpc/v21/MutateOperation).\n\nMutate operations\n-----------------\n\nEach [`MutateGoogleAdsRequest`](/google-ads/api/reference/rpc/v21/MutateGoogleAdsRequest)\naccepts a repeated [`MutateOperation`](/google-ads/api/reference/rpc/v21/MutateOperation), each of\nwhich can include a single operation for one resource type. To create one\ncampaign and one ad group in a single\n[`GoogleAdsService.Mutate`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Mutate) call,\nyou would need to create two [`MutateOperation`](/google-ads/api/reference/rpc/v21/MutateOperation)\nentities (one for the [`CampaignOperation`](/google-ads/api/reference/rpc/v21/CampaignOperation),\nthe other for the [`AdGroupOperation`](/google-ads/api/reference/rpc/v21/AdGroupOperation)),\nand then pass both to\n[`GoogleAdsService`](/google-ads/api/reference/rpc/v21/GoogleAdsService). \n\n### Ruby\n\n mutate_operation1 = client.operation(:Mutate)\n mutate_operation2 = client.operation(:Mutate)\n\n campaign_operation = client.operation(:Campaign)\n ad_group_operation = client.operation(:AdGroup)\n\n # Do some setup here to get campaign_operation and ad_group_operation into the\n # state you would want them for a regular mutate call to their respective\n # services.\n\n mutate_operation1.campaign_operation = campaign_operation\n mutate_operation2.ad_group_operation = ad_group_operation\n\n google_ads_service.mutate(customer_id, [mutate_operation1, mutate_operation2])\n\nLike other services, this endpoint supports\n[partial failure](/google-ads/api/docs/best-practices/partial-failures) and\nvalidate-only."]]