sdfdownloadtasks.create अनुरोध से, लंबे समय तक चलने वाली कार्रवाई शुरू होती है. इस ऑपरेशन से स्ट्रक्चर्ड डेटा फ़ाइलें (एसडीएफ़) जनरेट होती हैं.
अनुरोध फ़ील्ड, आपके एसडीएफ़ तय करते हैं:
partnerIdयाadvertiserId: इससे एसडीएफ़ के कॉन्टेंट को दिए गए पार्टनर या विज्ञापन देने वाले व्यक्ति या कंपनी के कॉन्टेक्स्ट तक सीमित किया जाता है. इनमें से सिर्फ़ एक फ़ील्ड सेट किया जा सकता है.version: इसका इस्तेमाल, एसडीएफ़ के उस वर्शन को तय करने के लिए किया जाता है जिसका इस्तेमाल करना है. अगर इसे सेट नहीं किया जाता है, तो यह डिफ़ॉल्ट रूप से पार्टनर या विज्ञापन देने वाले व्यक्ति या कंपनी की सेटिंग पर सेट होता है.parentEntityFilter,idFilterयाinventorySourceFilter: इससे एसडीएफ़ के कॉन्टेंट के बारे में पता चलता है. इनमें से सिर्फ़ एक फ़ील्ड सेट किया जा सकता है.
यहां दिए गए कैंपेन के लिए, इंसर्शन ऑर्डर और लाइन आइटम के एसडीएफ़ जनरेट करने वाला डाउनलोड टास्क बनाने का तरीका बताया गया है:
Java
// Provide the ID of the parent advertiser of the resources to retrieve. long advertiserId = advertiser-id; // Provide the Structured Data Files version to download. String sdfVersion = sdf-version; // Provide the IDs of the parent campaigns of the resources to retrieve. List<Long> campaignIds = campaign-ids; // Create the filter structure. ParentEntityFilter parentEntityFilter = new ParentEntityFilter() .setFileType(Arrays.asList("FILE_TYPE_INSERTION_ORDER", "FILE_TYPE_LINE_ITEM")) .setFilterType("FILTER_TYPE_CAMPAIGN_ID") .setFilterIds(campaignIds); // Configure and create the SDF download task. Operation operation = service .sdfdownloadtasks() .create( new CreateSdfDownloadTaskRequest() .setVersion(sdfVersion) .setAdvertiserId(advertiserId) .setParentEntityFilter(parentEntityFilter)) .execute(); // Print the resulting operation name. System.out.printf("Operation %s was created.", operation.getName());
Python
# Provide the ID of the parent advertiser of the resources to retrieve. advertiser_id = advertiser-id # Provide the Structured Data Files version to download. sdf_version = sdf-version # Provide the IDs of the parent campaigns of the resources to retrieve. campaign_ids = campaign-ids # Create the request body. body = { "version": sdf_version, "advertiserId": advertiser_id, "parentEntityFilter": { "fileType": ["FILE_TYPE_INSERTION_ORDER", "FILE_TYPE_LINE_ITEM"], "filterType": "FILTER_TYPE_CAMPAIGN_ID", "filterIds": campaign_ids, }, } # Create the operation. operation = service.sdfdownloadtasks().create(body=body).execute() # Print resulting operation name. print(f'Operation {operation["name"]} was created.')
PHP
// Provide the ID of the parent advertiser of the resources to retrieve. $advertiserId = advertiser-id; // Provide the Structured Data Files version to download. $sdfVersion = sdf-version; // Provide the IDs of the parent campaigns of the resources to retrieve. $campaignIds = campaign-ids; // Create the filter structure. $filter = new Google_Service_DisplayVideo_ParentEntityFilter(); $filter->setFileType(array('FILE_TYPE_INSERTION_ORDER','FILE_TYPE_LINE_ITEM')); $filter->setFilterType('FILTER_TYPE_CAMPAIGN_ID'); $filter->setFilterIds($campaignIds); // Configure and create the SDF download task. $createDownloadRequest = new Google_Service_DisplayVideo_CreateSdfDownloadTaskRequest(); $createDownloadRequest->setVersion($sdfVersion); $createDownloadRequest->setAdvertiserId($advertiserId); $createDownloadRequest->setParentEntityFilter($filter); // Call the API, creating the SDF Download Task. $operation = $this->service->sdfdownloadtasks->create( $createDownloadRequest ); // Print the resulting operation name. printf('<p>Operation %s was created.</p>', $operation['name']);