CampaignOperation와 같은 작업 객체를 사용하면 operation 필드를 설정하여 단일 리소스에서 실행할 작업을 지정할 수 있습니다. 이 필드는 리소스 유형이 유형인 다음 속성으로 구성된 oneof 필드입니다.
create
리소스의 새 인스턴스를 만듭니다.
update
update 리소스의 속성과 일치하도록 리소스를 업데이트합니다.
이 필드를 설정하면 업데이트 작업 중에 수정할 속성을 Google Ads API에 알려주는 작업의 update_mask도 설정해야 합니다. 각 클라이언트 라이브러리에는 update_mask를 생성하는 유틸리티 또는 도우미 메서드가 있습니다(클라이언트 라이브러리 참고).
remove
리소스를 삭제합니다.
operation 필드는 oneof 필드이므로 단일 작업을 사용하여 여러 객체를 수정할 수 없습니다. 예를 들어 캠페인 하나를 만들고 다른 캠페인을 삭제하려면 요청에 CampaignOperation 인스턴스를 두 개 추가합니다. 하나는 create이 설정된 인스턴스이고 다른 하나는 remove이 설정된 인스턴스입니다.
일괄 작업
단일 작업은 단일 리소스만 생성, 업데이트 또는 삭제할 수 있지만 단일 변이 요청에는 여러 작업이 포함될 수 있습니다. 각각 단일 작업을 포함하는 여러 변이 요청을 전송하는 대신 작업을 단일 변이 요청으로 결합해야 합니다.
예를 들어 캠페인 10개를 만들려면 CampaignOperation 객체가 10개 있는 단일MutateCampaignsRequest를 보내야 합니다.
응답 변경
응답에서 반환되는 내용은 변이 요청의 response_content_type에 전송된 내용에 따라 다릅니다. 예를 들어 MUTABLE_RESOURCE가 지정된 경우 response에는 캠페인의 변경 가능한 필드만 포함됩니다. 그런 다음 리소스 객체를 재구성하지 않고도 해당 리소스 객체에 후속 변형을 적용할 수 있습니다.
변형 오류
특정 변이 요청의 작업은 요청의 모든 작업이 성공한 경우에만 Google Ads 계정에 적용됩니다. 일반적인 오류 가이드에서 일반적인 오류 목록과 해결 방법을 확인하세요.
[null,null,["최종 업데이트: 2025-09-05(UTC)"],[[["\u003cp\u003eUse the Google Ads API to modify and inspect objects, such as campaigns, through their respective services.\u003c/p\u003e\n"],["\u003cp\u003eEach resource-type-specific service has a mutate method to create, update, or remove instances of that resource type.\u003c/p\u003e\n"],["\u003cp\u003eOperations within a single mutate request are atomic; all operations must succeed for any changes to be applied.\u003c/p\u003e\n"],["\u003cp\u003eBatch multiple operations into a single mutate request for efficiency, instead of sending individual requests.\u003c/p\u003e\n"],["\u003cp\u003eSpecify a response content type to control the data returned in the response, potentially streamlining further interactions.\u003c/p\u003e\n"]]],[],null,["# Change Objects\n\n| **Objective:** Understand how to modify objects using the Google Ads API.\n\nAs discussed in the [API structure guide](/google-ads/api/docs/concepts/api-structure), each\ntop-level resource in the Google Ads API has a corresponding resource-type-specific\nservice that supports modifying instances of the resource.\n\nThis guide will use [`CampaignService`](/google-ads/api/reference/rpc/v21/CampaignService) to\ndemonstrate modifying [`Campaign`](/google-ads/api/reference/rpc/v21/Campaign)\nobjects, but the same concepts apply to all other resource-type-specific\nservices.\n| **Key Term:** A top-level resource is a [resource](/google-ads/api/reference/rpc/v21/overview#resources) whose name does not include a period (`.`). For example, `Campaign` is a top-level resource, but `Campaign.NetworkSettings` is not.\n\nChange objects\n--------------\n\nEach resource-type-specific service will have a *mutate* method that accepts\na mutate request. This request consists of:\n\n- A `customerId`\n- A collection of operations\n- A response content-type setting that determines whether the mutable resource or just the resource name should be returned post mutation.\n\nFor example, the `MutateCampaigns` method of `CampaignService` accepts a\n[`MutateCampaignsRequest`](/google-ads/api/reference/rpc/v21/MutateCampaignsRequest) that consists\nof:\n\n- A `customerId`\n- A collection of `CampaignOperation` objects\n- The `response_content_type` field indicating the preferred response type.\n\n### Operations\n\nAn operation object such as a `CampaignOperation` lets you specify the\naction that you want to perform on a single resource by setting its `operation`\nfield. This field is a\n[oneof field](//protobuf.dev/programming-guides/proto3/#oneof)\nconsisting of the following attributes whose type is the resource type:\n\n`create`\n: Creates a new instance of the resource.\n\n`update`\n: Updates the resource to match the attributes of the `update` resource.\n When this field is set, you must also set the `update_mask` of the\n operation, which tells the Google Ads API which attributes to modify during\n the update operation. Each [client library](/google-ads/api/docs/client-libs) has a\n utility or helper method that will generate the `update_mask` for you, as\n demonstrated in our [client libraries](/google-ads/api/docs/client-libs).\n\n`remove`\n: Removes the resource.\n\nSince the `operation` field is a `oneof` field, you cannot use a single\noperation to modify multiple objects. For example, if you want to create one\ncampaign and remove another campaign, add two instances of `CampaignOperation`\nto your request: one with `create` set, and another with `remove` set.\n\n### Batch operations\n\nAlthough a single operation can only either create, update, or remove a single\nresource, a single mutate request can contain multiple operations. You should\ncombine your operations into a single mutate request instead of sending multiple\nmutate requests that each contain a single operation.\n\nFor example, if you want to create ten campaigns, you should send a\n*single* `MutateCampaignsRequest` that has ten `CampaignOperation` objects.\n\n### Mutate responses\n\nWhat is returned in the response depends on what was sent in the\n[`response_content_type`](/google-ads/api/reference/rpc/v21/ResponseContentTypeEnum.ResponseContentType)\nof the mutate request. For example, if `MUTABLE_RESOURCE` was specified, then\nthe [response](/google-ads/api/reference/rpc/v21/MutateCampaignsResponse) would contain just the\nmutable fields in the campaign. You can then make follow-up mutates on that\nresource object without having to reconstruct it.\n\n### Mutate errors\n\nThe operations in a given mutate request will only be applied to your Google Ads\naccount if *every* operation in the request succeeds. Check out the\n[common errors guide](/google-ads/api/docs/common-errors) for a list of common\nerrors and how to address them."]]