Right now, I'm currently using the Bing Ads Python SDK to ingest data in csv format using the Bulk Service Client on version 13. For this example, I'll include 'Ads' as the only download entity with no LastSyncTime variable set to collect all of the available data from the Bulk Service Endpoint for Ads. After creating the proper request and downloading the csv file from the appropriate URL, I'm returned a csv file with about 418 rows (most of which are empty which is correct), and two columns named 'AdGroup' and 'Campaign'. However, those two columns are simply the name of the AdGroup and Campaign rather than the ID. Is there a way to return the ID's of the AdGroup or Campaign rather than just the names?
Quick Note: I'm wanting to use the bulk_service_manager as it allows for the option of windowing the data that has been updated since a certain time. The history and the changes over time are required for Ads, AdGroups, and Campaigns.
Below is quick walkthrough of how I'm using the SDK right now. In this example, I'm wanting to pull back the 'Ads' object and its respective data. After creating the 'bulk_request' object, I'm waiting for the job to be completed before downloading the CSV file from the response URL. Regardless, the CSV returns the Ad Id, but the AdGroup and Campaign names rather than IDS.
from bingads.service_client import ServiceClient
from bingads.v13.reporting import *
from bingads.authorization import AuthorizationData, OAuthDesktopMobileAuthCodeGrant
authorization_data = AuthorizationData(
account_id = ACCOUNT_ID,
customer_id = CUSTOMER_ID,
developer_token = DEVELOPER_TOKEN,
authentication = None,
)
# authenticate authorization data through oAuth 2.0
authenticate(authorization_data)
# create the bulk service client
bulk_service = ServiceClient(
service='BulkService',
version=13,
authorization_data=authorization_data,
environment=ENVIRONMENT
)
# download the data related to each Ad
download_entities = bulk_service.factory.create('ArrayOfDownloadEntity')
download_entities.DownloadEntity = ['Ads']
bulk_request = bulk_service.DownloadCampaignsByAccountIds(
AccountIds={'long': [authorization_data.account_id] },
DataScope=['EntityData', 'QualityScoreData', 'BidSuggestionsData'],
DownloadEntities=download_entities,
FormatVersion="6.0",
LastSyncTimeInUTC=None
)