Thay đổi hàng loạt

Nếu cần vận hành trên nhiều loại thực thể cùng lúc hoặc muốn ghi dựa 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 biến đổi được hỗ trợ.

Thay đổi toán tử

Mỗi MutateGoogleAdsRequest chấp nhận một MutateOperation lặp lại, mỗi toán tử có thể bao gồm một toán tử duy nhất 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 2 thực thể MutateOperation (một cho CampaignOperation, một cho AdGroupOperation), sau đó chuyển cả hai thực thể này đến 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ợ lỗi một phần và chỉ xác thực.