大量修改

如果您需要同時對不同類型的實體進行操作,或偏好針對單一端點寫入,而非針對每個資源類型使用單獨的端點,可以使用 GoogleAdsService.Mutate 端點處理所有支援的變更作業。

更改作業

每個 MutateGoogleAdsRequest 都接受重複的 MutateOperation,每個都可包含一種資源類型的單一作業。如要在單一 GoogleAdsService.Mutate 呼叫中建立一個廣告活動和廣告群組,您需要建立兩個 MutateOperation 實體 (一個用於 CampaignOperation,另一個用於 AdGroupOperation),然後將兩者傳遞至 GoogleAdsService

Ruby

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_operation
mutate_operation2.ad_group_operation = ad_group_operation

google_ads_service.mutate(customer_id, [mutate_operation1, mutate_operation2])

如同其他服務,這個端點支援部分失敗和僅供驗證。