リソース サービスの変更
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
リソース固有のサービスを使用することは、リソース サービスを変更する最も直接的な方法ですが、最も柔軟性がありません。
エンドポイントの変更
リソース固有のサービスを使用するのが最も簡単な変更方法です。変更可能な各リソースには、リソースの作成、更新、削除を可能にする、対応するサービスと一連のオペレーションがあります。
新しい Campaign
を作成するとします。新しい Campaign
オブジェクトを作成し、CampaignOperation
内に配置して、CampaignService.MutateCampaigns
エンドポイントに送信します。
この操作は、Google Ads API サービスのいずれかで行うことができます。たとえば、AdGroup
を変更する場合は、変更した AdGroup
を含む AdGroupOperation
を AdGroupService.MutateAdGroups
エンドポイントに渡します。
同様に、CampaignCriterion
を変更する場合は、CampaignCriterionOperation
を使用して CampaignCriterionService.MutateCampaignCriteria
エンドポイントに送信します。
リクエストの operations
フィールドは繰り返すことができるので、単一の変更リクエストに複数のオペレーションを含めることができます。ただし、各オペレーションは他のすべてのオペレーションから独立して扱われるため、相互参照はできません。
これは、同じリクエスト内のオペレーションが他のオペレーションのエンティティを参照できる一括 mutate メソッド(GoogleAdsService.Mutate
)とは対照的です。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-05 UTC。
[null,null,["最終更新日 2025-09-05 UTC。"],[[["\u003cp\u003eThe most straightforward way to mutate a resource is by using its individual service and corresponding operations (create, update, or remove).\u003c/p\u003e\n"],["\u003cp\u003eEach mutable resource has a dedicated service with specific endpoints for mutation, like \u003ccode\u003eCampaignService.MutateCampaigns\u003c/code\u003e for \u003ccode\u003eCampaign\u003c/code\u003e resources.\u003c/p\u003e\n"],["\u003cp\u003eA single mutate request to a resource-specific service can handle multiple operations, but each operation is treated independently.\u003c/p\u003e\n"],["\u003cp\u003eResource-specific mutation differs from bulk mutation (\u003ccode\u003eGoogleAdsService.Mutate\u003c/code\u003e) where operations can cross-reference each other within the same request.\u003c/p\u003e\n"]]],[],null,["# Resource Service Mutates\n\nUsing a resource's individual service is the most straightforward way to mutate\nit, but also the least flexible.\n\nMutate Endpoints\n----------------\n\nUsing a resource-specific service is the most straightforward way to mutate.\nEach mutable resource has a corresponding service and a set of operations that\nenable you to create, update, or remove the resource.\n\nSuppose you want to create a new [`Campaign`](/google-ads/api/reference/rpc/v21/Campaign).\nYou would create a new [`Campaign`](/google-ads/api/reference/rpc/v21/Campaign)\nobject, put it inside a [`CampaignOperation`](/google-ads/api/reference/rpc/v21/CampaignOperation),\nand then send it to the\n[`CampaignService.MutateCampaigns`](/google-ads/api/reference/rpc/v21/CampaignService/MutateCampaigns)\nendpoint.\n\nYou can do this for any of the Google Ads API services. So for example, if you wanted\nto mutate an [`AdGroup`](/google-ads/api/reference/rpc/v21/AdGroup), you would pass an\n[`AdGroupOperation`](/google-ads/api/reference/rpc/v21/AdGroupOperation) containing the\nmutated [`AdGroup`](/google-ads/api/reference/rpc/v21/AdGroup) to the\n[`AdGroupService.MutateAdGroups`](/google-ads/api/reference/rpc/v21/AdGroupService/MutateAdGroups) endpoint.\n\nSimilarly, if you want to modify a [`CampaignCriterion`](/google-ads/api/reference/rpc/v21/CampaignCriterion), you would use a\n[`CampaignCriterionOperation`](/google-ads/api/reference/rpc/v21/CampaignCriterionOperation) and send it to the\n[`CampaignCriterionService.MutateCampaignCriteria`](/google-ads/api/reference/rpc/v21/CampaignCriterionService/MutateCampaignCriteria) endpoint.\n\nSince the `operations` field of the request can be repeated, a single mutate\nrequest can contain multiple operations. However, each operation is treated\nindependently from all others, so no cross-referencing is allowed.\n\nThis is in contrast to the bulk mutate method\n([`GoogleAdsService.Mutate`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Mutate)),\nwhere operations within the same request can reference entities from other\noperations."]]