Wyślij żądanie sdfdownloadtasks.create utworzenia zadania pobierania, które generuje pliki uporządkowanych danych (SDF).
Zdefiniuj SDF, używając tych pól w żądaniu:
partnerIdlubadvertiserId: wzajemnie wykluczające się pola, które definiują zasób nadrzędny (partnera lub reklamodawcę) dla zasobów wypełniających pliki SDF.version: wersja pliku SDF do użycia, jeśli różni się od wersji domyślnej ustawionej na poziomie partnera lub reklamodawcy.parentEntityFilter,idFilterlubinventorySourceFilter: wykluczające się pola, które przypisują filtr używany do określania typów plików i zasobów do uwzględnienia.
Użyj tego fragmentu kodu, aby utworzyć zadanie pobierania plików uporządkowanych danych zamówienia reklamowego i elementu zamówienia w przypadku danego reklamodawcy i w zakresie podanych identyfikatorów kampanii:
# 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.')