Google Business Performance API 的
NEW API 方法可擷取單一 API 要求中的多個「DailyMetrics」。
請詳閱
淘汰時間表和從 v4 reportInsights API 方法遷移至 Google Business Profile Performance API 的操作說明。
Method: accounts.locations.list
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
HTTP 要求
GET https://mybusiness.googleapis.com/v4/{parent=accounts/*}/locations
這個網址使用 gRPC 轉碼語法。
路徑參數
參數 |
parent |
string
要擷取位置的帳戶名稱。如果 Account 的值為 AccountType 個人,系統只會傳回帳戶直接擁有的位置,否則會傳回「帳戶」中的所有可存取位置 (無論是直接或間接)。
|
查詢參數
參數 |
pageSize |
integer
每頁要擷取的位置數量。預設值為 100,最少為 1,頁面大小上限為 100。
|
pageToken |
string
如有指定,它會擷取下一個 page 位置。如果位置超過可要求的網頁大小,則先前對 locations.list 的呼叫會傳回網頁權杖。
|
filter |
string
篩選器會限制要傳回的地點。回應只會包含與篩選條件相符的項目。如果 filter 空白,系統會套用限制,並擷取要求帳戶的所有地點 (已分頁)。 如要進一步瞭解有效欄位和使用範例,請參閱使用位置資料指南。
|
languageCode (deprecated) |
string
BCP 47 的語言代碼,用來取得顯示地點屬性。如果無法使用這個語言,系統將以該地區的語言提供。如果兩者皆無線,則會以英文提供。 已淘汰,2020 年 8 月 15 日後,這個欄位將無法再套用。因此會改用該位置的語言。
|
orderBy |
string
要求的排序順序。如有多個欄位,應遵循 SQL 語法,並以半形逗號分隔。預設的排序順序是遞增。如要指定遞減順序,請在後方加上「說明。orderBy 的有效欄位為 locationName 和 storeCode。例如:「locationName, storeCode desc」或「locationName」或「storeCode desc」
|
回應主體
如果成功,回應主體會含有以下結構的資料:
Locations.ListLocations 的回應訊息。
JSON 表示法 |
{
"locations": [
{
object (Location )
}
],
"nextPageToken": string,
"totalSize": integer
} |
欄位 |
locations[] |
object (Location )
營業地點。
|
nextPageToken |
string
如果地點數量超過要求的頁面大小,這個欄位就會填入符記,以便在之後呼叫 locations.list 時擷取下一頁的地點。如果沒有更多地點,系統就不會在回應中顯示這個欄位。
|
totalSize |
integer
清單中的約略位置數量 (無論分頁為何)。
|
授權範圍
需要下列其中一種 OAuth 範圍:
https://www.googleapis.com/auth/plus.business.manage
https://www.googleapis.com/auth/business.manage
詳情請參閱 OAuth 2.0 總覽。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[[["\u003cp\u003eLists all accessible locations for a specified Google My Business account, including directly or indirectly owned locations based on account type.\u003c/p\u003e\n"],["\u003cp\u003eAllows filtering, pagination, and sorting of location data through query parameters like \u003ccode\u003efilter\u003c/code\u003e, \u003ccode\u003epageSize\u003c/code\u003e, \u003ccode\u003epageToken\u003c/code\u003e, and \u003ccode\u003eorderBy\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eReturns a list of locations with details like location name, store code, and other properties, along with pagination information if applicable.\u003c/p\u003e\n"],["\u003cp\u003eRequires authorization with specific OAuth scopes for accessing and managing business data.\u003c/p\u003e\n"],["\u003cp\u003eProvides a total count of locations irrespective of pagination for easier management and understanding of the data set.\u003c/p\u003e\n"]]],[],null,["# Method: accounts.locations.list\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Path parameters](#body.PATH_PARAMETERS)\n- [Query parameters](#body.QUERY_PARAMETERS)\n- [Request body](#body.request_body)\n- [Response body](#body.response_body)\n - [JSON representation](#body.ListLocationsResponse.SCHEMA_REPRESENTATION)\n- [Authorization Scopes](#body.aspect)\n\nLists the locations for the specified account.\n\n### HTTP request\n\n`GET https://mybusiness.googleapis.com/v4/{parent=accounts/*}/locations`\n\nThe URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.\n\n### Path parameters\n\n| Parameters ||\n|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `parent` | `string` The name of the account to fetch locations from. If the [Account](/my-business/reference/rest/v4/accounts#Account) is of [AccountType](/my-business/reference/rest/v4/accounts#Account.AccountType) PERSONAL, only Locations that are directly owned by the Account are returned, otherwise it will return all accessible locations from the Account, either directly or indirectly. |\n\n### Query parameters\n\n| Parameters ||\n|---------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pageSize` | `integer` How many locations to fetch per page. Default is 100, minimum is 1, and maximum page size is 100. |\n| `pageToken` | `string` If specified, it fetches the next `page` of locations. The page token is returned by previous calls to `locations.list` when there were more locations than could fit in the requested page size. |\n| `filter` | `string` A filter constraining the locations to return. The response includes only entries that match the filter. If `filter` is empty, then constraints are applied and all locations (paginated) are retrieved for the requested account. For more information about valid fields and example usage, see [Work with Location Data Guide](https://developers.google.com/my-business/content/location-data#filter_results_when_you_list_locations). |\n| `languageCode` **(deprecated)** | `string` The BCP 47 code of language to get display location properties in. If this language is not available, they will be provided in the language of the location. If neither is available, they will be provided in English. Deprecated. After August 15th, 2020, this field will no longer be applied. Instead, the language of the location will always be used. |\n| `orderBy` | `string` Sorting order for the request. Multiple fields should be comma-separated, following SQL syntax. The default sorting order is ascending. To specify descending order, a suffix \" desc\" should be added. Valid fields to orderBy are locationName and storeCode. For example: \"locationName, storeCode desc\" or \"locationName\" or \"storeCode desc\" |\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 Locations.ListLocations.\n\n| JSON representation ||\n|-----------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ``` { \"locations\": [ { object (/my-business/reference/rest/v4/accounts.locations#Location) } ], \"nextPageToken\": string, \"totalSize\": integer } ``` |\n\n| Fields ||\n|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `locations[]` | `object (`[Location](/my-business/reference/rest/v4/accounts.locations#Location)`)` The locations. |\n| `nextPageToken` | `string` If the number of locations exceeded the requested page size, this field is populated with a token to fetch the next page of locations on a subsequent call to `locations.list`. If there are no more locations, this field is not present in the response. |\n| `totalSize` | `integer` The approximate number of Locations in the list irrespective of pagination. |\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)."]]