需要授权
返回单个非抽样报告。 查看示例。
请求
HTTP 请求
GET https://www.googleapis.com/analytics/v3/management/accounts/accountId/webproperties/webPropertyId/profiles/profileId/unsampledReports/unsampledReportId
参数
参数名称 | 值 | 说明 |
---|---|---|
路径参数 | ||
accountId |
string |
要为其提取非抽样报告的帐号 ID。 |
profileId |
string |
要为其提取非抽样报告的数据视图(配置文件)ID。 |
unsampledReportId |
string |
要提取的非抽样报告的 ID。 |
webPropertyId |
string |
要为其提取非抽样报告的网络媒体资源 ID。 |
授权
此请求需要获得以下至少一个范围的授权(详细了解身份验证和授权)。
范围 |
---|
https://www.googleapis.com/auth/analytics |
https://www.googleapis.com/auth/analytics.edit |
https://www.googleapis.com/auth/analytics.readonly |
请求正文
使用此方法时请勿提供请求正文。
响应
如果成功,此方法将在响应正文中返回一个 management.unsampledReport 资源。
示例
注意:此方法的代码示例并未列出所有受支持的编程语言(请参阅客户端库页面,查看受支持的语言列表)。
Java
使用 Java 客户端库。
/* * Note: This code assumes you have an authorized Analytics service object. * See the Unsampled Reports Developer Guide for details. */ /* * This request gets an existing unsampled report. */ String unsampledReportId = "1112223334111222333411"; try { UnsampledReport report = analytics.management().unsampledReports(). get("123456", "UA-123456-1", "7654321", unsampledReportId).execute(); } catch (GoogleJsonResponseException e) { System.err.println("There was a service error: " + e.getDetails().getCode() + " : " + e.getDetails().getMessage()); }
PHP
使用 PHP 客户端库。
/** * Note: This code assumes you have an authorized Analytics service object. * See the Unsampled Reports Developer Guide for details. */ /** * This request gets an existing Unsampled Report. */ try { $unsampledReport = $analytics->management_unsampledReports->get('123456', 'UA-123456-1', '7654321', '1112223334111222333411'); } catch (apiServiceException $e) { print 'There was an Analytics API service error ' . $e->getCode() . ':' . $e->getMessage(); } catch (apiException $e) { print 'There was a general API error ' . $e->getCode() . ':' . $e->getMessage(); }
Python
使用 Python 客户端库。
# Note: This code assumes you have an authorized Analytics service object. # See the Unsampled Reports Developer Guide for details. # Example #1: # This request gets an existing unsampled report. try: unsampled_report = analytics.management().unsampledReports().get( accountId='123456', webPropertyId='UA-123456-1', profileId='7654321', unsampledReportId='1112223334111222333411' ).execute() except TypeError, error: # Handle errors in constructing a query. print 'There was an error in constructing your query : %s' % error except HttpError, error: # Handle API errors. print ('There was an API error : %s : %s' % (error.resp.status, error.resp.reason))
JavaScript
使用 JavaScript 客户端库。
/* * Note: This code assumes you have an authorized Analytics client object. * See the Unsampled Reports Developer Guide for details. */ /* * This request gets an existing unsampled report. */ function getUnsampledReport() { var request = gapi.client.analytics.management.unsampledReports.get({ 'accountId': '123456', 'webPropertyId': 'UA-123456-1', 'profileId': '7654321', 'unsampledReportId': '1112223334111222333411' }); request.execute(function (response) { /* Handle the response. */ }); }