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.
After an uploaded Structured Data File has been processed successfully, download
the resulting ZIP file from the provided resource location using
media.download.
Here's how to retrieve the file location and download the ZIP file:
# Import the object used for media download.fromgoogleapiclientimporthttpasgoogleHttpimportio# Provide the name of the successfully completed sdfuploadtask operation.operation_name=operation-name# Provide the path for the output file.output_path=output-path# Retrieve the completed operation.operation=service.sdfuploadtasks().operations().get(operation_name).execute()# Retrieve the file location from the operation.file_location=operation["response"]["resourceName"]# Configure the media.download request.download_request=service.media().download_media(resourceName=file_location)# Create output stream for downloaded file.out_stream=io.FileIO(output_path,mode='wb')# Build downloader object.downloader=googleHttp.MediaIoBaseDownload(out_stream,download_request)# Download file in chunks until finished.download_finished=Falsewhiledownload_finishedisFalse:_,download_finished=downloader.next_chunk()print(f'File downloaded at {output_path}.')
Extract files
Decompress the downloaded ZIP file to extract the results of your SDF upload.
One or both of the following possible result files may be present, with
{EntityName} being the type of resource, such as LineItems:
SDF-{EntityName}-Updated-ResultFile.csv, which lists the resources that have
been successfully created or updated
SDF-{EntityName}-Failed-ResultFile.csv, which lists the resources that have
failed to be updated or created, along with an error message.
[[["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,["# Download results\n\nAfter an uploaded Structured Data File has been processed successfully, download\nthe resulting `ZIP` file from the provided resource location using\n[`media.download`](/display-video/api/sdf-upload/rest/v4/media/download).\n| **Note:** Specify the data format for your download response as `media` using the `alt` parameter, appending `?alt=media` to your download URL. Client libraries take care of this for you.\n\nHere's how to retrieve the file location and download the `ZIP` file: \n\n```python\n# Import the object used for media download.\nfrom googleapiclient import http as googleHttp\nimport io\n\n# Provide the name of the successfully completed sdfuploadtask operation.\noperation_name = operation-name\n\n# Provide the path for the output file.\noutput_path = output-path\n\n# Retrieve the completed operation.\noperation = service.sdfuploadtasks().operations().get(operation_name).execute()\n\n# Retrieve the file location from the operation.\nfile_location = operation[\"response\"][\"resourceName\"]\n\n# Configure the media.download request.\ndownload_request = service.media().download_media(resourceName=file_location)\n\n# Create output stream for downloaded file.\nout_stream = io.FileIO(output_path, mode='wb')\n\n# Build downloader object.\ndownloader = googleHttp.MediaIoBaseDownload(out_stream, download_request)\n\n# Download file in chunks until finished.\ndownload_finished = False\nwhile download_finished is False:\n _, download_finished = downloader.next_chunk()\n\nprint(f'File downloaded at {output_path}.')\n```\n\nExtract files\n-------------\n\nDecompress the downloaded `ZIP` file to extract the results of your SDF upload.\nOne or both of the following possible result files may be present, with\n`{EntityName}` being the type of resource, such as `LineItems`:\n\n- `SDF-{EntityName}-Updated-ResultFile.csv`, which lists the resources that have been successfully created or updated\n- `SDF-{EntityName}-Failed-ResultFile.csv`, which lists the resources that have failed to be updated or created, along with an error message."]]