无法使用Java从Google Analytics(分析)下载未采样的报告 [英] Unable to download unsampled report from Google Analytics using Java

查看:48
本文介绍了无法使用Java从Google Analytics(分析)下载未采样的报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们已经使用Google控制台创建了非抽样报告,并且该报告是在Google云端硬盘下生成的.现在,为了使下载过程自动化,我们正在尝试使用Java下载报告.
根据Google Analytics(分析)API库,可以使用Report的 selfLink()方法来完成此操作.我们可以使用此方法打印链接,但无法下载报告.没有错误,但下载过程失败.我们该如何解决?

We have created unsampled report using Google console and the report got generated under Google Drive. Now to automate the downloading process, we are trying to download the report using Java.
As per Google Analytics API library, it can be done by using Report's selfLink() method. We are able to print the link using this method but unable to download the report. There is no error but download process is failing. How can we fix this?

推荐答案

selflink 属性是该特定资源的自我链接.要实际下载未采样报告的结果,您需要设置云存储API 请求或 Drive API 请求,具体取决于您的实现.

The selflink property for the unsampled report resource, is the self link for that particular resource. To actually download the results of an unsampled report, you need to go set up either a cloud storage API request or a Drive API request depending on your implementation.

例如,如果您的非抽样报告存储在Google云端硬盘中,则您向文件的资源URL发出授权的HTTP GET请求,并包含查询参数alt = media.例如:

For example if your unsampled report is stored in Google Drive, you make an authorized HTTP GET request to the file's resource URL and include the query parameter alt=media. For example:

GET https://www.googleapis.com/drive/v2/files/XXXXXX?alt=media
Authorization: Bearer ya29.AHESVbXTUv5mHMo3RYfmS1YJonjzzdTOFZwvyOAUVhrs

其中XXXXXXX是未抽样报告driveDownloadDetails.documentId .

where XXXXXXX is the unsampled report driveDownloadDetails.documentId.

这篇关于无法使用Java从Google Analytics(分析)下载未采样的报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆