ঐচ্ছিক অনুরোধ শিরোনাম
সেভ করা পৃষ্ঠা গুছিয়ে রাখতে 'সংগ্রহ' ব্যবহার করুন
আপনার পছন্দ অনুযায়ী কন্টেন্ট সেভ করুন ও সঠিক বিভাগে রাখুন।
একটি অনুরোধ পদ্ধতিতে কোনো ঐচ্ছিক ক্ষেত্র ব্যবহার করার সময়, অনুরোধ বার্তাটি অবশ্যই পদ্ধতির বাইরে তৈরি করতে হবে এবং একটি একক প্যারামিটার হিসাবে পাস করতে হবে।
ঐচ্ছিক অনুরোধ শিরোনাম, উদাহরণস্বরূপ GoogleAdsService.Search
পদ্ধতিতে validate_only
হেডার, কীওয়ার্ড প্যারামিটার হিসাবে পদ্ধতি স্বাক্ষরে উপস্থিত নেই, তাই সেগুলি অবশ্যই সরাসরি অনুরোধ বার্তায় সেট করতে হবে।
একটি রিকোয়েস্ট অবজেক্ট ফিল্ড প্রয়োজন বা ঐচ্ছিক কিনা তা নির্ধারণ করতে, আপনি পরিষেবাগুলির জন্য প্রোটোবাফ সংজ্ঞা উল্লেখ করতে পারেন এবং টীকা [(google.api.field_behavior) = REQUIRED]
আছে এমন ক্ষেত্রগুলি সন্ধান করতে পারেন।
এখানে একটি উদাহরণ দেওয়া হল যেটি একটি GoogleAdsService.Search
জন্য ঐচ্ছিক validate_only
ক্ষেত্র সেট করে। অনুসন্ধানের অনুরোধ:
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 License-এর অধীনে এবং কোডের নমুনাগুলি Apache 2.0 License-এর অধীনে লাইসেন্স প্রাপ্ত। আরও জানতে, Google Developers সাইট নীতি দেখুন। Java হল Oracle এবং/অথবা তার অ্যাফিলিয়েট সংস্থার রেজিস্টার্ড ট্রেডমার্ক।
2025-08-26 UTC-তে শেষবার আপডেট করা হয়েছে।
[null,null,["2025-08-26 UTC-তে শেষবার আপডেট করা হয়েছে।"],[[["\u003cp\u003eWhen using optional fields in Google Ads API requests, construct the request message separately and pass it as a single parameter to the method.\u003c/p\u003e\n"],["\u003cp\u003eOptional request headers like \u003ccode\u003evalidate_only\u003c/code\u003e are set directly on the request message, not as keyword parameters in the method signature.\u003c/p\u003e\n"],["\u003cp\u003eYou can identify required or optional request fields by checking the protobuf definitions and looking for the \u003ccode\u003e[(google.api.field_behavior) = REQUIRED]\u003c/code\u003e annotation.\u003c/p\u003e\n"],["\u003cp\u003eTo 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.\u003c/p\u003e\n"]]],[],null,["# Optional request headers\n\nWhen using any\n[optional fields](//protobuf.dev/programming-guides/proto3/#field-labels) on a\nrequest method, the request message must be constructed outside of the\nmethod and passed in as a single parameter.\n\nOptional request headers, for example the\n[`validate_only`](/google-ads/api/reference/rpc/v21/SearchGoogleAdsRequest#validate_only) header in\nthe [`GoogleAdsService.Search`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Search) method,\nare not present in the method signature as keyword parameters, so they must be\nset on the request message directly.\n\nTo determine if a request object field is required or optional, you can\nreference the [protobuf definitions for\nservices](//github.com/googleapis/googleapis/tree/master/google/ads/googleads/v21/services)\nand look for fields that contain the annotation `[(google.api.field_behavior) =\nREQUIRED]`.\n\nHere's an example that sets the optional `validate_only` field\non a [`GoogleAdsService.Search`](/google-ads/api/reference/rpc/v21/GoogleAdsService/Search) request: \n\n request = client.get_type(\"SearchGoogleAdsRequest\")\n request.customer_id = customer_id\n request.query = query\n request.validate_only = True\n\n response = googleads_service.search(request=request)"]]