试用 Google Analytics 的 MCP 服务器。从
GitHub 安装,并参阅
公告了解详情。
Method: accounts.list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
返回调用方可以访问的所有账号。
请注意,这些账号目前可能没有 GA 媒体资源。默认情况下,系统会排除已软删除(即“移至回收站”)的账号。如果找不到相关账号,则返回空列表。
HTTP 请求
GET https://analyticsadmin.googleapis.com/v1alpha/accounts
网址采用 gRPC 转码语法。
查询参数
参数 |
pageSize |
integer
要返回的资源的数量上限。服务返回的数量可能小于此值,即使有其他网页也是如此。如果未指定,则最多返回 50 个资源。最大值为 200;(更高的值将被强制转换为最大值)
|
pageToken |
string
从之前的 accounts.list 调用接收的页面令牌。提供此令牌以检索后续页面。进行分页时,提供给 accounts.list 的所有其他参数必须与提供页面令牌的调用匹配。
|
showDeleted |
boolean
是否在结果中包含已软删除(即“移至回收站”)的账号。您可以检查账号,以确定其是否已被删除。
|
响应正文
accounts.list RPC 的请求消息。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"accounts": [
{
object (Account )
}
],
"nextPageToken": string
} |
字段 |
accounts[] |
object (Account )
可供调用方访问的结果。
|
nextPageToken |
string
可作为 pageToken 发送并用于检索下一页的令牌。如果省略此字段,则不存在后续页面。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/analytics.readonly
https://www.googleapis.com/auth/analytics.edit
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eRetrieves and lists all Google Analytics 4 accounts accessible by the caller, excluding soft-deleted accounts by default.\u003c/p\u003e\n"],["\u003cp\u003eAllows for pagination to handle large result sets using \u003ccode\u003epageSize\u003c/code\u003e and \u003ccode\u003epageToken\u003c/code\u003e parameters.\u003c/p\u003e\n"],["\u003cp\u003eOptionally includes soft-deleted accounts using the \u003ccode\u003eshowDeleted\u003c/code\u003e parameter.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with specific scopes for data access.\u003c/p\u003e\n"]]],["This document details how to retrieve a list of accessible accounts using a `GET` request to `https://analyticsadmin.googleapis.com/v1alpha/accounts`. The request body must be empty. Optional query parameters `pageSize` (max 200) and `pageToken` support pagination, and `showDeleted` includes trashed accounts. The response includes an array of \"accounts\" and `nextPageToken` for pagination. Authorization requires either `analytics.readonly` or `analytics.edit` OAuth scopes.\n"],null,["# Method: accounts.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListAccountsResponse.SCHEMA_REPRESENTATION)\n- [Authorization scopes](#body.aspect)\n- [Try it!](#try-it)\n\nReturns all accounts accessible by the caller.\n\nNote that these accounts might not currently have GA properties. Soft-deleted (ie: \"trashed\") accounts are excluded by default. Returns an empty list if no relevant accounts are found.\n\n### HTTP request\n\n`GET https://analyticsadmin.googleapis.com/v1alpha/accounts`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pageSize` | `integer` The maximum number of resources to return. The service may return fewer than this value, even if there are additional pages. If unspecified, at most 50 resources will be returned. The maximum value is 200; (higher values will be coerced to the maximum) |\n| `pageToken` | `string` A page token, received from a previous `accounts.list` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `accounts.list` must match the call that provided the page token. |\n| `showDeleted` | `boolean` Whether to include soft-deleted (ie: \"trashed\") Accounts in the results. Accounts can be inspected to determine whether they are deleted or not. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nRequest message for accounts.list RPC.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"accounts\": [ { object (/analytics/devguides/config/admin/v1/rest/v1alpha/accounts#Account) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------|\n| `accounts[]` | `object (`[Account](/analytics/devguides/config/admin/v1/rest/v1alpha/accounts#Account)`)` Results that were accessible to the caller. |\n| `nextPageToken` | `string` A token, which can be sent as `pageToken` to retrieve the next page. If this field is omitted, there are no subsequent pages. |\n\n### Authorization scopes\n\nRequires one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/analytics.readonly`\n- `https://www.googleapis.com/auth/analytics.edit`"]]