Why is Google Analytics API for Unsampled Reports not showing Google Drive Download Link?

与世无争的帅哥 提交于 2021-01-29 15:54:16

问题


The CSV is downloaded to Google Drive but when I query the unsampled report ID with get unsampled report no download type appears in the response...

This is the resource that's supposed to appear. But I get a partial response as:

{
  "id": string,
  "kind": "analytics#unsampledReport",
  "selfLink": string,
  "title": string,
  "accountId": string,
  "webPropertyId": string,
  "profileId": string,
  "start-date": string,
  "end-date": string,
  "status": string,
  "created": datetime,
  "updated": datetime 
}

I have a service account with the following API's enabled:

  • Google Analytics API
  • Google Analytics Reporting API
  • Google Drive API

I have all the permissions for my service account in Google Analytics.

I'm using python client to make the request:

accountId = self._ga_property.account_id
web_property_id = self._ga_property.web_property_id
unsampled_report = self._auth_service.management().unsampledReports().get(
            accountId=accountId,
            webPropertyId=web_property_id,
            profileId=self._profileId,
            unsampledReportId=id
        ).execute()
return unsampled_report

If you need any extra information I'm happy to provide.

I've already tried Stack Overflow answer but download link is not inside my response.

The problem isn't getting a response, the problem is getting a partial response


回答1:


You can find download link in your response if the status is COMPLETE. When you query an unsampled report the status is PENDING. Try to call the report ID after few minutes and when status is COMPLETE the API should return a driveDownloadDetails.documentId.



来源:https://stackoverflow.com/questions/61056687/why-is-google-analytics-api-for-unsampled-reports-not-showing-google-drive-downl

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!