إذا كنت بحاجة إلى العمل على أنواع مختلفة من الكيانات في الوقت نفسه أو إذا كنت تفضّل الكتابة مقابل نقطة نهاية واحدة بدلاً من استخدام نقطة نهاية منفصلة لكل نوع من الموارد، يمكنك استخدام نقطة نهاية GoogleAdsService.Mutate
لجميع عمليات التبديل المتوافقة.
تبديل العمليات
تقبل كل MutateGoogleAdsRequest
عنصر MutateOperation
متكرّرًا، ويمكن أن يشتمل كل عنصر
من هذه العناصر على عملية واحدة لنوع واحد من الموارد. لإنشاء حملة واحدة ومجموعة إعلانية واحدة في مكالمة
GoogleAdsService.Mutate
واحدة،
ستحتاج إلى إنشاء كيانَين على MutateOperation
(أحدهما CampaignOperation
والآخر للسمة AdGroupOperation
)،
ثم ضبطهما معًا إلى
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])
وكما هو الحال مع الخدمات الأخرى، تتوافق نقطة النهاية هذه مع الفشل الجزئي والتحقق من الصحة فقط.