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.')