如果您需要同时对不同类型的实体执行操作,或者
希望对单个端点进行写操作,而不愿每种资源类型使用单独的端点,则可以将
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])
与其他服务一样,此端点支持 部分失败和 仅验证功能。