如果您需要同時處理不同類型的實體,或是偏好以單一端點寫入,而不是針對每種資源類型使用不同的端點,則可使用 GoogleAdsService.Mutate
端點來處理所有支援的 Variant 作業。
異動作業
每個 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])
與其他服務一樣,此端點支援部分失敗和僅供驗證。