Method: accounts.list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
列出经过身份验证的用户的所有账号。这包括用户拥有的所有账号,以及用户拥有管理权限的所有账号。
HTTP 请求
GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts
网址采用 gRPC 转码语法。
查询参数
参数 |
parentAccount |
string
可选。要检索可直接访问的账号列表的账号的资源名称。这仅适用于组织和用户组。如果为空,则针对经过身份验证的用户返回 accounts.list 。accounts/{account_id} 。
|
pageSize |
integer
可选。每页提取的账号数量。默认值和最大值为 20。
|
pageToken |
string
可选。如果指定,则检索到账号的下一页。当调用 accounts.list 返回的结果数超过所请求的页面大小所能容纳的数量时,系统会返回 pageToken 。
|
filter |
string
可选。限制要返回的账号的过滤条件。响应仅包含与过滤条件匹配的条目。如果 filter 为空,则系统不会应用任何限制条件,并且系统将为所请求的账号检索所有账号(已分页)。 例如,包含过滤条件 type=USER_GROUP 的请求将仅返回用户组。 type 字段是唯一受支持的过滤条件。
|
响应正文
Accounts.ListAccounts 的响应消息。
如果成功,响应正文将包含结构如下的数据:
JSON 表示法 |
{
"accounts": [
{
object (Account )
}
],
"nextPageToken": string
} |
字段 |
accounts[] |
object (Account )
用户有访问权限的一组账号。执行查询的用户的个人账号将始终是结果的第一项,除非它被滤除。
|
nextPageToken |
string
如果账号数量超过所请求的页面大小,系统会使用令牌填充此字段,以在后续调用 accounts.list 时获取下一页账号。如果没有更多账号,则响应中不会显示此字段。
|
授权范围
需要以下 OAuth 范围:
https://www.googleapis.com/auth/business.manage
如需了解详情,请参阅 OAuth 2.0 概览。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-25。
[null,null,["最后更新时间 (UTC):2025-07-25。"],[[["\u003cp\u003eLists all accounts owned by or accessible to the authenticated user, including their personal account.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering accounts by type and specifying the parent account for retrieval.\u003c/p\u003e\n"],["\u003cp\u003eSupports pagination to retrieve large lists of accounts using \u003ccode\u003epageToken\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes an array of \u003ccode\u003eAccount\u003c/code\u003e objects and a \u003ccode\u003enextPageToken\u003c/code\u003e for further results.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003ehttps://www.googleapis.com/auth/business.manage\u003c/code\u003e OAuth scope for authorization.\u003c/p\u003e\n"]]],["This API retrieves a list of accounts for an authenticated user via a `GET` request to a specified URL. The user can filter the accounts by type, specify the page size, and use a `pageToken` for pagination. An optional `parentAccount` parameter retrieves accounts directly accessible from that account. The request body must be empty, and the successful response includes an array of account objects and, if applicable, a `nextPageToken` for further pagination. This uses OAuth 2.0 with the `business.manage` scope.\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\nLists all of the accounts for the authenticated user. This includes all accounts that the user owns, as well as any accounts for which the user has management rights.\n\n### HTTP request\n\n`GET https://mybusinessaccountmanagement.googleapis.com/v1/accounts`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parentAccount` | `string` Optional. The resource name of the account for which the list of directly accessible accounts is to be retrieved. This only makes sense for Organizations and User Groups. If empty, will return `accounts.list` for the authenticated user. `accounts/{account_id}`. |\n| `pageSize` | `integer` Optional. How many accounts to fetch per page. The default and maximum is 20. |\n| `pageToken` | `string` Optional. If specified, the next page of accounts is retrieved. The `pageToken` is returned when a call to `accounts.list` returns more results than can fit into the requested page size. |\n| `filter` | `string` Optional. A filter constraining the accounts to return. The response includes only entries that match the filter. If `filter` is empty, then no constraints are applied and all accounts (paginated) are retrieved for the requested account. For example, a request with the filter `type=USER_GROUP` will only return user groups. The `type` field is the only supported filter. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nResponse message for Accounts.ListAccounts.\n\nIf successful, the response body contains data with the following structure:\n\n| JSON representation |\n|-------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"accounts\": [ { object (/my-business/reference/accountmanagement/rest/v1/accounts#Account) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `accounts[]` | `object (`[Account](/my-business/reference/accountmanagement/rest/v1/accounts#Account)`)` A collection of accounts to which the user has access. The personal account of the user doing the query will always be the first item of the result, unless it is filtered out. |\n| `nextPageToken` | `string` If the number of accounts exceeds the requested page size, this field is populated with a token to fetch the next page of accounts on a subsequent call to `accounts.list`. If there are no more accounts, this field is not present in the response. |\n\n### Authorization scopes\n\nRequires the following OAuth scope:\n\n- `https://www.googleapis.com/auth/business.manage`\n\nFor more information, see the [OAuth 2.0 Overview](https://developers.google.com/identity/protocols/OAuth2)."]]