广告数据中心API分析查询

问题描述 投票:0回答:1

我们如何使用 Python 中的 API 执行广告数据中心的所有分析查询,因为我能够运行单个查询,但数据未保存在 Daaset 中

添加了为此运行创建的服务帐户作为超级用户进入广告数据中心界面用户

我正在尝试使用 API 为客户运行所有查询

我尝试使用以下方法运行单个查询

queries=service.customers().analysisQueries().start(

        name='customer_name',
        body={
            'spec': {
                'adsDataCustomerId': '',
                'timeZone': 'UTC',
                'startDate': {'year': 2022, 'month': 12, 'day': 1},
                'endDate': {'year': 2022, 'month': 12, 'day': 12},
            },
            'destTable' : 'projectName.datasetName.Table'
        }
    ).execute()
After running these queries I am getting response as querymetadata as below 

{"name": "": {"@type": "type.googleapis.com/google.ads.adsdatahub.v1.QueryMetadata", "queryResourceName": "", "queryTitle": "title of the query", "customerId": "customerId", "adsDataCustomerId": "adsdatacustomerId", "matchDataCustomerId": "", "parameterValues": {"start_date": {"value": ""}, "end_date": {"value": ""}, "time_zone": {"value": "UTC"}}, "startTime": "", "endTime": "", "destTable": ""}}

But data is not saving in Big query data set
python google-api-python-client google-ads-data-hub ads-data-hub
1个回答
0
投票

“name”不是客户名称,它应该是资源名称,例如“customers/(Customer ID)/analysisQueries/(queryID)” 此外,adsDataCustomerID 不应为空。 adsDataCustomerID 应是您的 ADH 帐户的 ID,customerID 是您的 ADH 链接到广告平台(Google Ads 或 DV360)的 ID。

你可以跑 service.customers().analysisQueries().list(parent=customer_name).execute() 获取所有存储查询的 queryID。

© www.soinside.com 2019 - 2024. All rights reserved.