Thay đổi hàng loạt

Nếu cần thực hiện 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 duy nhất thay vì sử dụng một điểm cuối riêng biệt 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ợ.

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 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 duy nhất, bạn cần tạo 2 thực thể MutateOperation (một cho CampaignOperation, một cho AdGroupOperation), rồi truyề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.