異なる種類のエンティティを同時に操作する必要がある場合や単一のエンドポイントに対して書き込みを行う(リソースタイプごとに別々のエンドポイントを使用するのではなく)場合は、サポートされているすべての変更オペレーションに GoogleAdsService.Mutate
エンドポイントを使用できます。
mutate オペレーション
各 MutateGoogleAdsRequest
は繰り返しの MutateOperation
を受け取り、それぞれは 1 つのリソースタイプに対して 1 つのオペレーションを含めることができます。1 回の GoogleAdsService.Mutate
呼び出しで 1 つのキャンペーンと 1 つの広告グループを作成するには、2 つの MutateOperation
エンティティ(CampaignOperation
用と AdGroupOperation
用)を作成して、両方を GoogleAdsService
に渡す必要があります。
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])
他のサービスと同様に、このエンドポイントは Partial Failure と検証のみをサポートします。