Starting September 8, 2025, every new line item will need to declare whether or not they will serve Eurpoean Union (EU) political ads. Display & Video 360 API and SDF uploads that don't provide declarations will fail. See our deprecations page for more details on how to update your integration to make this declaration.
Stay organized with collections
Save and categorize content based on your preferences.
Structured Data Files don't generate instantaneously. Display & Video 360 might
take anywhere from a few seconds to hours to generate your SDFs.
To determine if your task is finished, regularly retrieve the operation using
sdfdownloadtasks.operations.get and check if the
done field is True and the task is finished. This process is
known as "polling."
If the task is finished, either the response or
error field is set. If the error field is populated, the
task failed and details about the failure are available in the resulting
Status object. If the response field is populated,
Display & Video 360 successfully generated the SDFs. Download the resulting files
from the location provided in response.resourceName.
An inefficient polling implementation that checks on a long-running report
consumes a lot of your API request quota. To limit retries and
conserve quota, use exponential backoff.
Here's how to poll a SDF download operation using exponential backoff:
# Provide the name of the sdfdownloadtask operation.operation_name=operation-name# Set the following values that control retry behavior while the operation# is running.# 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 sdfdownloadtasks.operations.get request.get_request=service.sdfdownloadtasks().operations().get(operation_name)sleep=0start_time=time.time()whileTrue:# Get current status of the report.operation=get_request.execute()if"done"inoperation:if"error"inoperation:print(f'The operation finished in error with code 'f'{operation["error"]["code"]}: {operation["error"]["message"]}')else:print(f'The operation completed successfully. The resulting files can be 'f'downloaded at {operation["response"]["resourceName"]}.')breakeliftime.time()-start_time>max_retry_elapsed_time:print("SDF generation deadline exceeded.")breaksleep=next_sleep_interval(sleep)print(f'Operation {operation_name} is still running, sleeping for 'f'{sleep} seconds.')time.sleep(sleep)defnext_sleep_interval(previous_sleep_interval):"""Calculates the next sleep interval based on the previous."""min_interval=previous_sleep_intervalormin_retry_intervalmax_interval=previous_sleep_interval*3ormin_retry_intervalreturnmin(max_retry_interval,random.randint(min_interval,max_interval))
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-15 UTC."],[],[],null,["# Poll task status\n\nStructured Data Files don't generate instantaneously. Display \\& Video 360 might\ntake anywhere from a few seconds to hours to generate your SDFs.\n\nTo determine if your task is finished, regularly retrieve the operation using\n[`sdfdownloadtasks.operations.get`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations/get) and check if the\n[`done`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.FIELDS.done) field is `True` and the task is finished. This process is\nknown as \"polling.\"\n\nIf the task is finished, either the [`response`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.FIELDS.response) or\n[`error`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.FIELDS.error) field is set. If the [`error`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.FIELDS.error) field is populated, the\ntask failed and details about the failure are available in the resulting\n[`Status`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.Status) object. If the [`response`](/display-video/api/sdf-upload/rest/v4/sdfdownloadtasks.operations#Operation.FIELDS.response) field is populated,\nDisplay \\& Video 360 successfully generated the SDFs. Download the resulting files\nfrom the location provided in `response.resourceName`.\n\nAn inefficient polling implementation that checks on a long-running report\nconsumes a lot of your [API request quota](/display-video/api/limits). To limit retries and\nconserve quota, use [exponential backoff](/display-video/api/guides/best-practices/quota#implement_exponential_backoff_for_long-running_operations).\n\nHere's how to poll a SDF download operation using exponential backoff: \n\n```gdscript\n# Provide the name of the sdfdownloadtask operation.\noperation_name = operation-name\n\n# Set the following values that control retry behavior while the operation\n# is running.\n# Minimum amount of time between polling requests. Defaults to 5 seconds.\nmin_retry_interval = 5\n# Maximum amount of time between polling requests. Defaults to 5 minutes.\nmax_retry_interval = 5 * 60\n# Maximum amount of time to spend polling. Defaults to 5 hours.\nmax_retry_elapsed_time = 5 * 60 * 60\n\n# Configure the sdfdownloadtasks.operations.get request.\nget_request = service.sdfdownloadtasks().operations().get(operation_name)\n\nsleep = 0\n\nstart_time = time.time()\nwhile True:\n # Get current status of the report.\n operation = get_request.execute()\n\n if \"done\" in operation:\n if \"error\" in operation:\n print(\n f'The operation finished in error with code '\n f'{operation[\"error\"][\"code\"]}: {operation[\"error\"][\"message\"]}')\n else:\n print(\n f'The operation completed successfully. The resulting files can be '\n f'downloaded at {operation[\"response\"][\"resourceName\"]}.')\n break\n elif time.time() - start_time \u003e max_retry_elapsed_time:\n print(\"SDF generation deadline exceeded.\")\n break\n\n sleep = next_sleep_interval(sleep)\n print(\n f'Operation {operation_name} is still running, sleeping for '\n f'{sleep} seconds.')\n time.sleep(sleep)\n\ndef next_sleep_interval(previous_sleep_interval):\n \"\"\"Calculates the next sleep interval based on the previous.\"\"\"\n min_interval = previous_sleep_interval or min_retry_interval\n max_interval = previous_sleep_interval * 3 or min_retry_interval\n return min(max_retry_interval, random.randint(min_interval, max_interval))\n```"]]