我正试图从AdExchange卖方API检索一份报告。我使用的是最大允许的维度和度量量,因此报告相当大(>100.000行)。根据关于大型报告的文件,这可以通过添加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)
但这到底有什么用呢?据我所知,事实并非如此。
发布于 2016-11-02 13:23:55
发布于 2016-11-02 18:24:34
这在PHP客户机库中应该是可能的。下面的示例演示如何使用Drive执行此操作:
$fileId = '0BwwA4oUTeiV1UVNwOHItT0xfa2M';
$content = $driveService->files->get($fileId, array(
'alt' => 'media' ));https://developers.google.com/drive/v3/web/manage-downloads#examples
https://stackoverflow.com/questions/40379366
复制相似问题