هل يهمّك مشاركة ملاحظاتك حول Google Ads API؟
اشترِك للاستفادة من فرصة المشاركة في الأبحاث المتعلّقة بالمستخدمين.
عناوين الطلبات الاختيارية
عند استخدام أي
حقول اختيارية في إحدى methods
لطلبات البحث، يجب إنشاء رسالة الطلب خارج method ونقلها كمَعلمة واحدة.
لا تتوفّر رؤوس الطلبات الاختيارية، مثل عنوان
validate_only
في
الطريقة GoogleAdsService.Search
،
في توقيع الطريقة كمَعلمات كلمات رئيسية، لذا يجب
ضبطها في رسالة الطلب مباشرةً.
لتحديد ما إذا كان حقل عنصر الطلب مطلوبًا أو اختياريًا، يمكنك
الرجوع إلى تعريفات protobuf ل
الخدمات
والبحث عن الحقول التي تحتوي على التعليق التوضيحي [(google.api.field_behavior) =
REQUIRED]
.
في ما يلي مثال على ضبط الحقل الاختياري validate_only
في طلب GoogleAdsService.Search
:
request = client.get_type("SearchGoogleAdsRequest")
request.customer_id = customer_id
request.query = query
request.validate_only = True
response = googleads_service.search(request=request)
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-03-04 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-03-04 (حسب التوقيت العالمي المتفَّق عليه)"],[[["When using optional fields in Google Ads API requests, construct the request message separately and pass it as a single parameter to the method."],["Optional request headers like `validate_only` are set directly on the request message, not as keyword parameters in the method signature."],["You can identify required or optional request fields by checking the protobuf definitions and looking for the `[(google.api.field_behavior) = REQUIRED]` annotation."],["To use optional fields, create an instance of the request message type, populate its fields including the optional ones, and then pass it to the API method."]]],[]]