批量转变

如果您需要同时对不同类型的实体执行操作,或者 倾向于针对单个端点写入,而不是使用单独的端点 则您可以使用 GoogleAdsService.Mutate 所有受支持的 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])

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