การเปลี่ยนบริการทรัพยากร
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
การใช้บริการของทรัพยากรแต่ละรายการเป็นวิธีที่ตรงไปตรงมาที่สุดในการเปลี่ยนแปลง
ทรัพยากร แต่ก็มีความยืดหยุ่นน้อยที่สุดด้วย
เปลี่ยนแปลงปลายทาง
การใช้บริการเฉพาะทรัพยากรเป็นวิธีที่ตรงไปตรงมาที่สุดในการเปลี่ยนแปลง
ทรัพยากรที่เปลี่ยนแปลงได้แต่ละรายการจะมีบริการที่เกี่ยวข้องและชุดการดำเนินการที่
ช่วยให้คุณสร้าง อัปเดต หรือนำทรัพยากรออกได้
สมมติว่าคุณต้องการสร้าง Campaign
ใหม่
คุณจะต้องสร้างCampaign
ออบเจ็กต์ใหม่ ใส่ไว้ในCampaignOperation
แล้วส่งไปยังปลายทาง CampaignService.MutateCampaigns
คุณดำเนินการนี้ได้กับบริการ Google Ads API ใดก็ได้ เช่น หากต้องการ
เปลี่ยนAdGroup
คุณจะต้องส่ง
AdGroupOperation
ที่มี
AdGroup
ที่เปลี่ยนแล้วไปยัง
ปลายทาง AdGroupService.MutateAdGroups
ในทำนองเดียวกัน หากต้องการแก้ไข CampaignCriterion
คุณจะต้องใช้
CampaignCriterionOperation
และส่งไปยังปลายทาง
CampaignCriterionService.MutateCampaignCriteria
เนื่องจากฟิลด์ operations
ของคำขอสามารถทำซ้ำได้ คำขอ mutate เดียวจึงสามารถมีการดำเนินการหลายอย่างได้ อย่างไรก็ตาม ระบบจะถือว่าการดำเนินการแต่ละอย่าง
แยกจากกันทั้งหมด จึงไม่อนุญาตให้มีการอ้างอิงข้าม
ซึ่งแตกต่างจากเมธอดการเปลี่ยนแปลงแบบกลุ่ม
(GoogleAdsService.Mutate
)
ซึ่งการดำเนินการภายในคำขอเดียวกันสามารถอ้างอิงเอนทิตีจากการดำเนินการอื่นๆ ได้
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-08-27 UTC
[null,null,["อัปเดตล่าสุด 2025-08-27 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."]]