खास जानकारी

स्ट्रक्चर्ड डेटा फ़ाइलें (एसडीएफ़), खास तौर पर फ़ॉर्मैट की गई कॉमा लगाकर अलग की गई वैल्यू (CSV) होती हैं ऐसी फ़ाइलें जो Display &Video 360 के बारे में डेटा को वापस पाने और अपडेट करने के लिए इस्तेमाल की जाती हैं इसमें वीडियो 360 के संसाधन बल्क. Google Display &Video 360 के ज़रिए Video 360 API में, पसंद के मुताबिक बनाए गए एसडीएफ़ जनरेट और डाउनलोड किए जा सकते हैं, इससे आपको अपने Display &Video 360 खाते में व्यवस्थित, फ़िल्टर किया गया डेटा वापस पाने में वीडियो 360 संसाधन.

इस गाइड में एसडीएफ़ डाउनलोड करने की कार्रवाई को ट्रैक करने का तरीका बताया गया है कार्रवाई को चुनें, और इससे बने एसडीएफ़ डाउनलोड करें.

एसडीएफ़ फ़ॉर्मैट और वर्शन से जुड़ी जानकारी यहां मिल सकती है एसडीएफ़ के लिए दस्तावेज़.

टास्क बनाना

एसडीएफ़, एसिंक्रोनस तरीके से जनरेट होते हैं. इस ऑपरेशन को sdfdownloadtask कहा जाता है. इस टास्क को बनाते समय, अपनी पसंद के एसडीएफ़ के पैरामीटर तय किए जा सकते हैं. ऐसा, sdfdownloadtasks.create तरीके से किया जाता है. कॉन्टेंट बनाने इन सब-सेक्शन में, उन पैरामीटर के बारे में बताया गया है जिन्हें सेट किया जा सकता है.

वर्शन तय करें

स्ट्रक्चर्ड डेटा फ़ाइल फ़ॉर्मैट को नियमित तौर पर, डिसप्ले और Video 360 API, जिसमें नए और पुराने वर्शन रिलीज़ हुए हैं नियमित रूप से बंद कर दिया जाता है. इस वजह से, यह लोगों को हमेशा एसडीएफ़ के सबसे नए वर्शन का इस्तेमाल करने की सलाह दी जाती है.

अपने हिसाब से एसडीएफ़ का एसडीएफ़ वर्शन सेट करने के लिए, अनुरोध के मुख्य हिस्से में मौजूद version फ़ील्ड में. अगर यह नीति सेट या सेट नहीं की गई है SDF_VERSION_UNSPECIFIED करने के लिए, टास्क एसडीएफ़ कॉन्टेंट के लिए, विज्ञापन देने वाले या पार्टनर के संसाधन का इस्तेमाल किया गया हो.

संदर्भ सेट करना

ऐसा एसडीएफ़ जनरेट किया जा सकता है जिसमें आपके लिए उपलब्ध किसी भी संसाधन के डेटा का इस्तेमाल किया गया हो. हालांकि, कोई भी व्यक्ति एसडीएफ़ को सिर्फ़ एक बार पार्टनर या विज्ञापनदाता. अनुरोध के मुख्य हिस्से में, इस कॉन्टेक्स्ट के बारे में इनमें से किसी एक तरीके से बताया गया है partnerId या advertiserId फ़ील्ड. इन दोनों में से कोई एक फ़ील्ड सेट होने चाहिए.

नतीजे के तौर पर मिलने वाले एसडीएफ़ में, सिर्फ़ दिए गए कॉन्टेक्स्ट में मौजूद संसाधनों को ही शामिल किया जाएगा. अगर किसी ऐसे संसाधन के हिसाब से फ़िल्टर करने की कोशिश की जाती है जो बताए गए पार्टनर के मालिकाना हक में नहीं है या विज्ञापन देने वाले लोग या कंपनियां, न तो इसे और न ही इसके तहत आने वाले कॉन्टेंट को नतीजे. अगर सिर्फ़ इन शामिल नहीं किए गए संसाधनों के हिसाब से फ़िल्टर किया जाता है, तो नतीजे में मिलने वाली फ़ाइलें खाली रहेगा. दिए गए कॉन्टेक्स्ट से बाहर के रिसॉर्स के हिसाब से फ़िल्टर करने की कोशिश करना गड़बड़ी नहीं दिखाएगा, इसलिए पक्का करें कि आपने संदर्भ के तौर पर सही है.

सही फ़िल्टर चुनें

ऊपर दिए गए संदर्भ के अलावा, आपके पास आपकी पसंद के फ़ाइल टाइप तय करके जनरेट की गई स्ट्रक्चर्ड डेटा फ़ाइलें ऐसे संसाधन या संसाधनों को जनरेट करना चाहिए जिन्हें आपको शामिल करना है.

sdfdownloadtask के लिए तीन फ़िल्टर उपलब्ध हैं. हर फ़िल्टर इन फ़िल्टर के हिसाब से होता है खास तरह का विवरण है. किसी एक क्वेरी के लिए, सिर्फ़ एक असाइन किया जा सकता है sdfdownloadtask.

ParentEntityFilter

ParentEntityFilter, उपलब्ध डेटा में सबसे ज़्यादा है फ़िल्टर.

fileType फ़ील्ड का इस्तेमाल करके, फ़ाइल टाइप जिन्हें आपको टास्क के साथ जनरेट करना है. यह है ज़रूरी है. अगर इसे खाली छोड़ दिया जाता है या FILE_TYPE_UNSPECIFIED पर सेट किया जाता है, तो आपका sdfdownloadtask गलती से पूरा हो जाएगा.

filterType का इस्तेमाल करके और filterIds फ़ील्ड में, अपने नतीजों को और बेहतर बनाया जा सकता है. filterType संसाधन और filterIds के हिसाब से फ़िल्टर करें उन संसाधनों को उनकी यूनीक आईडी से पहचानती है. नतीजे में मिलने वाले एसडीएफ़ में ये शामिल होंगे fileType ने ऐसे संसाधनों की पहचान की है जो या तो द्वारा बताए गए संसाधनों के संसाधन या चिल्ड्रन filterType और filterIds.

IdFilter

IdFilter आपके अनुरोध को फ़िल्टर करके, सिर्फ़ संसाधनों को शामिल करता है पहचानी गई.

IdFilter में हर तरह के एसडीएफ़ टाइप के लिए एक फ़ील्ड होता है. इसमें इन्वेंट्री शामिल नहीं है सोर्स. इनमें से हर एक फ़ील्ड, आपको इसके लिए, आपको जनरेट किए गए एसडीएफ़ में शामिल करने होंगे. दिए गए आईडी संदर्भ सेट के अंदर होने चाहिए, लेकिन उनका सीधे तौर पर संबंधित होना ज़रूरी नहीं है. आपने लोगों तक पहुंचाया मुफ़्त में नहीं है कि ज़रूरी नहीं है कि मैं किसी कैंपेन के लाइन आइटम का अनुरोध करने के लिए, उस कैंपेन इसमें शामिल है और इसी के साथ. सिर्फ़ उनमें से फ़ाइल टाइप जनरेट होंगे IdFilter में बताए गए संसाधनों से मिलते-जुलते हैं.

InventorySourceFilter

InventorySourceFilter सिर्फ़ फ़िल्टर करने की अनुमति देता है और ऐसे एसडीएफ़ को डाउनलोड करना होगा जिनमें इन्वेंट्री सोर्स के संसाधन मौजूद हों. सिर्फ़ यही एक फ़िल्टर का इस्तेमाल कर सकते हैं, जिसका इस्तेमाल अपने इन्वेंट्री स्रोत संसाधनों के बारे में जानकारी पाने के लिए किया जा सकता है.

InventorySourceFilter का मतलब एकवचन है inventorySourceIds फ़ील्ड, जिसमें यूनीक वैल्यू की पहचान की जाती है इन्वेंट्री सोर्स के उन संसाधनों के आईडी जिन्हें आपको एसडीएफ़ में शामिल करना है. अगर inventorySourceIds को दी गई सूची खाली है, सभी तय कॉन्टेक्स्ट के तहत, इन्वेंट्री के सोर्स को जनरेट किए गए एसडीएफ़ में शामिल किया जाएगा.

अनुरोध करें

अपनी पसंद के एसडीएफ़ के पैरामीटर जानने के बाद, अनुरोध किया जा सकता है और sdfdownloadtask बनाएं.

यहां उदाहरण के तौर पर sdfdownloadtask को ParentEntityFilter:

Java

// Create the filter structure
ParentEntityFilter parentEntityFilter = new ParentEntityFilter();
parentEntityFilter.setFileType(sdf-file-type-list);
parentEntityFilter.setFilterType(sdfFilterType);
parentEntityFilter.setFilterIds(filter-id-list);

// Configure the sdfdownloadtasks.create request
Sdfdownloadtasks.Create request =
   service
       .sdfdownloadtasks()
       .create(
           new CreateSdfDownloadTaskRequest()
               .setVersion(sdfVersion)
               .setAdvertiserId(advertiserId)
               .setParentEntityFilter(parentEntityFilter)
       );

// Create the sdfdownloadtask
Operation operationResponse = request.execute();

System.out.printf("Operation %s was created.\n",
   operationResponse.getName());

Python

# Configure the sdfdownloadtasks.create request
createSdfDownloadTaskRequest = {
    'version': sdf-version,
    'advertiserId': advertiser-id,
    'parentEntityFilter': {
        'fileType': sdf-file-type-list,
        'filterType': sdf-filter-type,
        'filterIds': filter-id-list
    }
}

# Create the sdfdownloadtask
operation = service.sdfdownloadtasks().create(
    body=createSdfDownloadTaskRequest).execute();

print("Operation %s was created." % operation["name"])

PHP

// Create the sdfdownloadtasks.create request structure
$createSdfDownloadTaskRequest =
    new Google_Service_DisplayVideo_CreateSdfDownloadTaskRequest();
$createSdfDownloadTaskRequest->setAdvertiserId(advertiser-id);
$createSdfDownloadTaskRequest->setVersion(sdf-version);

// Create and set the parent entity filter
$parentEntityFilter = new Google_Service_DisplayVideo_ParentEntityFilter();
$parentEntityFilter->setFileType(sdf-file-type-list);
$parentEntityFilter->setFilterType(sdf-filter-type);
if (!empty(filter-id-list)) {
    $parentEntityFilter->setFilterIds(filter-id-list);
}
$createSdfDownloadTaskRequest->setParentEntityFilter($parentEntityFilter);

// Call the API, creating the SDF Download Task.
$operation = $this->service->sdfdownloadtasks->create(
    $createSdfDownloadTaskRequest
);

printf('Operation %s was created.\n', $operation->getName());

अपने अनुरोध की जांच करें और डाउनलोड पाथ पाएं

जब आप कोई sdfdownloadtask बनाते हैं, तो एक ऑपरेशन ऑब्जेक्ट होता है वापस किया गया. इस कार्रवाई से आपके एसिंक्रोनस एसडीएफ़ की स्थिति के बारे में पता चलता है जेनरेशन ऑपरेशन का हिस्सा है. कारोबार की जगह की जानकारी देखने के लिए, देखें कि क्या यह पूरा हो गया है और डाउनलोड के लिए तैयार है या उसमें कोई गड़बड़ी हुई है. sdfdownloadtasks.operations.get तरीका.

पूरा होने के बाद, वापस की गई कार्रवाई के लिए कोई वैल्यू नहीं दिखेगी done फ़ील्ड. खत्म हो चुकी कार्रवाई में इनमें से कोई एक काम होगा response या error फ़ील्ड में डालें. अगर यह मौजूद होगा, तो error फ़ील्ड में Status ऑब्जेक्ट में गड़बड़ी कोड है और मैसेज, जिससे इस गड़बड़ी के बारे में जानकारी मिलती है हुआ. अगर response फ़ील्ड मौजूद है, तो इसका मतलब है कि में resourceName वैल्यू वाला एक ऑब्जेक्ट होगा, जो जनरेट किए गए डाउनलोड करने के लिए फ़ाइल.

एक्स्पोनेंशियल बैकऑफ़ का इस्तेमाल करके अपने अनुरोध की जांच करने का तरीका यहां दिया गया है:

Java

String operationName = operationResponse.getName();

// Configure the Operations.get request
Sdfdownloadtasks.Operations.Get operationRequest =
   service
       .sdfdownloadtasks()
       .operations()
       .get(operationName);

// Configure exponential backoff for checking the status of our operation
ExponentialBackOff backOff = new ExponentialBackOff.Builder()
   .setInitialIntervalMillis(5000) // setting initial interval to five seconds
   .setMaxIntervalMillis(300000)  // setting max interval to five minutes
   .setMaxElapsedTimeMillis(18000000) // setting max elapsed time to five hours
   .build();

while (operationResponse.getDone() == null) {
 long backoffMillis = backOff.nextBackOffMillis();
 if (backoffMillis == ExponentialBackOff.STOP) {
   System.out.printf("The operation has taken more than five hours to
       complete.\n");
   return;
 }
 Thread.sleep(backoffMillis);

 // Get current status of operation
 operationResponse = operationRequest.execute();
}

// Check if the operation finished with an error and return
if (operationResponse.getError() != null) {
 System.out.printf("The operation finished in error with code %s: %s\n",
     operationResponse.getError().getCode(), operationResponse.getError()
         .getMessage());
 return;
}

System.out.printf(
    "The operation completed successfully. Resource %s was created.\n",
    operationResponse.getResponse().get("resourceName").toString());

Python

# The following values control retry behavior while
# the report is processing.
# Minimum amount of time between polling requests. Defaults to 5 seconds.
min_retry_interval = 5
# Maximum amount of time between polling requests. Defaults to 5 minutes.
max_retry_interval = 5 * 60
# Maximum amount of time to spend polling. Defaults to 5 hours.
max_retry_elapsed_time = 5 * 60 * 60

# Configure the Operations.get request
get_request = service.sdfdownloadtasks().operations().get(
  name=operation["name"]
)

sleep = 0
start_time = time.time()
while True:
  # Get current status of operation
  operation = get_request.execute()

  if "done" in operation:
    if "error" in operation:
      print("The operation finished in error with code %s: %s" % (
            operation["error"]["code"],
            operation["error"]["message"]))
    else:
      print("The operation completed successfully. Resource %s was created."
            % operation["response"]["resourceName"])
    break
  elif time.time() - start_time > max_retry_elapsed_time:
    print("Generation deadline exceeded.")

  sleep = next_sleep_interval(sleep)
  print("Operation still running, sleeping for %d seconds." % sleep)
  time.sleep(sleep)

def next_sleep_interval(previous_sleep_interval):
  """Calculates the next sleep interval based on the previous."""
  min_interval = previous_sleep_interval or min_retry_interval
  max_interval = previous_sleep_interval * 3 or min_retry_interval
  return min(max_retry_interval, random.randint(min_interval, max_interval))

PHP

// The following values control retry behavior
// while the task is processing.
// Minimum amount of time between polling requests. Defaults to 5 seconds.
$minRetryInterval = 5;
// Maximum amount of time between polling requests. Defaults to 5 minutes.
$maxRetryInterval = 300;
// Maximum amount of time to spend polling. Defaults to 5 hours.
$maxRetryElapsedTime = 18000;

$operationName = $operation->getName();

$sleepInterval = 0;
$startTime = time();

while (!$operation->getDone()) {
    if ($sleepInterval != 0) {
        printf(
            'The operation is still running, sleeping for %d seconds\n',
            $sleepInterval
        );
    }

    // Sleep before retrieving the SDF Download Task again.
    sleep($sleepInterval);

    // Call the API, retrieving the SDF Download Task.
    $operation = $this->service->sdfdownloadtasks_operations->get(
        $operation->getName()
    );

    // If the operation has exceeded the set deadline, throw an exception.
    if (time() - $startTime > $maxRetryElapsedTime) {
        printf('SDF download task processing deadline exceeded\n');
        throw new Exception(
            'Long-running operation processing deadline exceeded'
        );
    }

    // Generate the next sleep interval using exponential backoff logic.
    $sleepInterval = min(
        $maxRetryInterval,
        rand(
            max($minRetryInterval, $previousSleepInterval),
            max($minRetryInterval, $previousSleepInterval * 3)
        )
    );
}

// If the operation finished with an error, throw an exception.
if($operation->getError() !== null) {
    $error = $operation->getError();
    printf(
        'The operation finished in error with code %s: %s\n',
        $error->getCode(),
        $error->getMessage()
    );
    throw new Exception($error->getMessage());
}

// Print successfully generated resource.
$response = $operation->getResponse();
printf(
    'The operation completed successfully. Resource %s was '
        . 'created. Ready to download.\n',
    $response['resourceName']
);