Method: accounts.list
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
列出经过身份验证的用户的所有账号。这包括用户拥有的所有账号,以及用户拥有管理权限的所有账号。
HTTP 请求
GET https://mybusiness.googleapis.com/v4/accounts
网址采用 gRPC 转码语法。
查询参数
参数 |
pageSize |
integer
每页提取的账号数量。默认值为 20,最小值为 2,页面大小上限为 20。
|
pageToken |
string
如果指定,则检索到账号的下一页。当调用 accounts.list 返回的结果数超过所请求的页面大小所能容纳的数量时,系统会返回 pageToken 。
|
name |
string
要检索可直接访问的账号列表的账号的资源名称。这仅适用于组织和用户组。如果为空,则针对经过身份验证的用户返回 accounts.list 。
|
filter |
string
限制要返回的账号的过滤条件。响应仅包含与过滤条件匹配的条目。如果 filter 为空,则系统不会应用任何限制条件,并且系统将为所请求的账号检索所有账号(已分页)。 例如,包含过滤条件 type=USER_GROUP 的请求将仅返回用户组。
|
响应正文
如果成功,响应正文将包含结构如下的数据:
Accounts.ListAccounts 的响应消息。
JSON 表示法 |
{
"accounts": [
{
object (Account )
}
],
"nextPageToken": string
} |
字段 |
accounts[] |
object (Account )
用户有访问权限的一组账号。执行查询的用户的个人账号将始终是结果的第一项,除非它被滤除。
|
nextPageToken |
string
如果账号数量超过所请求的页面大小,系统会使用令牌填充此字段,以在后续调用 accounts.list 时获取下一页账号。如果没有更多账号,则响应中不会显示此字段。
|
授权范围
需要以下 OAuth 范围之一:
https://www.googleapis.com/auth/plus.business.manage
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\u003eThis API endpoint, now deprecated, was used to retrieve a list of Google My Business accounts for the authenticated user, including owned and managed accounts.\u003c/p\u003e\n"],["\u003cp\u003eThe response includes account details and a pagination token for retrieving additional results.\u003c/p\u003e\n"],["\u003cp\u003eFiltering options were available to narrow down the returned accounts based on criteria like account type.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization required either \u003ccode\u003ehttps://www.googleapis.com/auth/plus.business.manage\u003c/code\u003e or \u003ccode\u003ehttps://www.googleapis.com/auth/business.manage\u003c/code\u003e scope.\u003c/p\u003e\n"],["\u003cp\u003eUsers should now utilize the Account Management API for similar functionality.\u003c/p\u003e\n"]]],["This document outlines how to retrieve a list of accounts for an authenticated user via a `GET` request to `https://mybusiness.googleapis.com/v4/accounts`. The request can utilize query parameters like `pageSize`, `pageToken`, `name`, and `filter` to control the results. The request body must be empty. A successful response includes an array of `accounts` and optionally a `nextPageToken` for pagination. Authorization requires specific 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\n| Deprecated. Please use the [Account Management API](https://developers.google.com/my-business/reference/accountmanagement/rest/v1/accounts/list) instead.\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://mybusiness.googleapis.com/v4/accounts`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Query parameters\n\n| Parameters ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pageSize` | `integer` How many accounts to fetch per page. Default is 20, minimum is 2, and maximum page size is 20. |\n| `pageToken` | `string` 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| `name` | `string` 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. |\n| `filter` | `string` 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. |\n\n### Request body\n\nThe request body must be empty.\n\n### Response body\n\nIf successful, the response body contains data with the following structure:\nResponse message for Accounts.ListAccounts.\n\n| JSON representation ||\n|-------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"accounts\": [ { object (/my-business/reference/rest/v4/accounts#Account) } ], \"nextPageToken\": string } ``` |\n\n| Fields ||\n|-----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `accounts[]` | `object (`[Account](/my-business/reference/rest/v4/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 one of the following OAuth scopes:\n\n- `https://www.googleapis.com/auth/plus.business.manage`\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)."]]