【发布时间】:2016-11-02 11:56:41
【问题描述】:
我正在尝试从AdExchange Seller API 检索报告。
我正在使用最大允许数量的维度和指标,因此报告非常大(> 100.000 行)。根据documentation on large reports,这可以通过添加alt=media 参数来使用限制突破功能。但我不知道如何使用Google API client for PHP 添加该参数。我更愿意坚持使用 Google 官方库,但我愿意接受建议。
注意:将alt=csv 或alt=media 添加到optParams 不起作用,如果我删除一些维度和指标,我可以轻松访问数据。
更具体地说,我使用的是accounts_reports 资源,然后是generate 方法。查看源代码(如下所示),我看不到它可以接受alt 参数的任何地方,但我显然遗漏了一些东西。
$this->accounts_reports = new Google_Service_AdExchangeSeller_Resource_AccountsReports(
$this,
$this->serviceName,
'reports',
array(
'methods' => array(
'generate' => array(
'path' => 'accounts/{accountId}/reports',
'httpMethod' => 'GET',
'parameters' => array(
'accountId' => array(
'location' => 'path',
'type' => 'string',
'required' => true,
),
'startDate' => array(
'location' => 'query',
'type' => 'string',
'required' => true,
),
'endDate' => array(
'location' => 'query',
'type' => 'string',
'required' => true,
),
'dimension' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'filter' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'locale' => array(
'location' => 'query',
'type' => 'string',
),
'maxResults' => array(
'location' => 'query',
'type' => 'integer',
),
'metric' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'sort' => array(
'location' => 'query',
'type' => 'string',
'repeated' => true,
),
'startIndex' => array(
'location' => 'query',
'type' => 'integer',
),
),
),
)
)
);
进一步挖掘,我在Google_Service_AdExchangeSeller_Resource_AccountsReports 类中找到了这个语句。
根据查询中发送的报告请求生成 Ad Exchange 报告 参数。以 JSON 格式返回结果;以 CSV 格式检索输出 指定“alt=csv”作为查询参数。 (reports.generate)
但这究竟是如何工作的呢?据我所知,它没有。
【问题讨论】:
标签: php google-api google-api-php-client