发出 sdfdownloadtasks.create
请求以创建用于生成结构化数据文件 (SDF) 的下载任务。
使用请求中的以下字段定义 SDF:
partnerId
或advertiserId
:互斥字段,用于为填充 SDF 的资源定义父级资源(合作伙伴或广告客户)。version
:要使用的 SDF 版本(如果与在合作伙伴级或广告客户级设置的默认版本不同)。parentEntityFilter
、idFilter
或inventorySourceFilter
:互斥字段,用于指定用于指定要包含的文件类型和资源的过滤条件。
使用以下代码段,为指定广告客户名下并在所提供广告系列 ID 范围内的广告订单和订单项结构化数据文件创建下载任务:
# 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.')