เปลี่ยนแปลงหลายรายการพร้อมกัน

หากต้องดำเนินการกับเอนทิตีประเภทต่างๆ พร้อมกัน หรือต้องการเขียนกับปลายทางเดียวแทนที่จะใช้ปลายทางแยกต่างหากสำหรับทรัพยากรแต่ละประเภท คุณสามารถใช้ปลายทาง GoogleAdsService.Mutate สำหรับการดำเนินการเปลี่ยนแปลงที่รองรับทั้งหมด

เปลี่ยนรูปแบบการดำเนินการ

MutateGoogleAdsRequest แต่ละรายการจะยอมรับ MutateOperation ที่ซ้ำกัน ซึ่งแต่ละประเภทจะมีการดำเนินการรายการเดียวสำหรับประเภททรัพยากร 1 ประเภท หากต้องการสร้างแคมเปญ 1 แคมเปญและกลุ่มโฆษณา 1 กลุ่มในการโทร GoogleAdsService.Mutate ครั้งเดียว คุณจะต้องสร้างเอนทิตี MutateOperation 2 รายการ (รายการหนึ่งสำหรับ CampaignOperation และอีก 1 รายการสำหรับ AdGroupOperation) จากนั้นส่งทั้ง 2 เอนทิตีไปยัง 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])

ปลายทางนี้รองรับความล้มเหลวบางส่วนและการตรวจสอบเท่านั้น เช่นเดียวกับบริการอื่นๆ