Thay đổi hàng loạt

Nếu cần thao tác trên nhiều loại thực thể cùng một lúc hoặc muốn ghi vào một điểm cuối thay vì sử dụng một điểm cuối riêng cho mỗi loại tài nguyên, thì bạn có thể sử dụng điểm cuối GoogleAdsService.Mutate cho tất cả các thao tác thay đổi được hỗ trợ.

Thao tác thay đổi

Mỗi MutateGoogleAdsRequest chấp nhận một MutateOperation lặp lại, mỗi MutateOperation có thể bao gồm một thao tác cho một loại tài nguyên. Để tạo một chiến dịch và một nhóm quảng cáo trong một lệnh gọi GoogleAdsService.Mutate, bạn cần tạo hai thực thể MutateOperation (một cho CampaignOperation, còn lại là cho AdGroupOperation), sau đó truyền cả hai vào 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])

Giống như các dịch vụ khác, điểm cuối này hỗ trợ một phần lỗi và chỉ xác thực.