שולחים בקשת sdfdownloadtasks.create ליצירת משימת הורדה שמפיקה קבצים של נתונים מובְנים (SDF).
מגדירים את קובצי ה-SDF באמצעות השדות הבאים בבקשה:
-
partnerIdאוadvertiserId: שדות שאינם תלויים זה בזה ומגדירים משאב אב (שותף או מפרסם) למשאבים שמאכלסים את קובצי ה-SDF. -
version: גרסת ה-SDF לשימוש, אם היא שונה מברירת המחדל שמוגדרת ברמת השותף או המפרסם. -
parentEntityFilter,idFilterאוinventorySourceFilter: שדות שאי אפשר להשתמש בהם בו-זמנית, שבהם מציינים את המסנן שמשמש להגדרת סוגי הקבצים והמשאבים שרוצים לכלול.
משתמשים בקטע הקוד הזה כדי ליצור משימת הורדה של קובצי נתונים מובנים של הזמנת פרסום ופריט הזמנה, עבור המפרסם שצוין ובמסגרת מזהי הקמפיינים שסופקו:
# 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.')