Make an sdfdownloadtasks.create
request to create a
download task that generates Structured Data Files (SDFs).
Define your SDFs using the following fields of your request:
partnerId
oradvertiserId
: Mutually-exclusive fields that define a parent resource (either a partner or advertiser) for the resources populating the SDFs.version
: The SDF version to use, if different from the default set at the partner or advertiser level.parentEntityFilter
,idFilter
orinventorySourceFilter
: Mutually-exclusive fields that assign the filter used to specify the file types and resources to include.
Use this code snippet to create a download task for Insertion Order and Line Item Structured Data Files under the given advertiser and within the scope of provided campaign IDs:
# 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-id, ...] # 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.')