提出 sdfdownloadtasks.create
要求,建立下載工作,產生結構化資料檔案 (SDF)。
請使用要求中的下列欄位定義 SDF:
partnerId
或advertiserId
:互斥欄位,用於為填入結構化資料檔案的資源定義上層資源 (合作夥伴或廣告客戶)。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.')