批量转变

如果您需要同时对不同类型的实体执行操作,或者希望对单个端点执行写入操作,而不是为每种资源类型使用单独的端点,则可以对所有受支持的 mutate 操作使用 GoogleAdsService.Mutate 端点。

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])

与其他服务一样,此端点支持部分失败和仅验证。