Method: accounts.locations.list
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
Liệt kê các vị trí cho tài khoản đã chỉ định.
Yêu cầu HTTP
GET https://mybusiness.googleapis.com/v4/{parent=accounts/*}/locations
URL sử dụng cú pháp Chuyển mã gRPC.
Tham số đường dẫn
Tham số |
parent |
string
Tên tài khoản dùng để tìm nạp vị trí. Nếu Account là của AccountType CÁ NHÂN, thì chỉ những Vị trí thuộc sở hữu trực tiếp của Tài khoản mới được trả về, nếu không thì dữ liệu này sẽ trả về tất cả thông tin vị trí có thể truy cập được từ Tài khoản, theo cách trực tiếp hoặc gián tiếp.
|
Tham số truy vấn
Tham số |
pageSize |
integer
Số lượng vị trí cần tìm nạp trên mỗi trang. Giá trị mặc định là 100, tối thiểu là 1 và kích thước trang tối đa là 100.
|
pageToken |
string
Nếu được chỉ định, phương thức này sẽ tìm nạp page vị trí tiếp theo. Mã thông báo trang được các lệnh gọi trước đó trả về cho locations.list khi có nhiều vị trí hơn số lượng vị trí có thể phù hợp với kích thước trang được yêu cầu.
|
filter |
string
Bộ lọc ràng buộc vị trí cần trả về. Phản hồi chỉ bao gồm các mục khớp với bộ lọc. Nếu filter trống, thì các điều kiện ràng buộc sẽ được áp dụng và tất cả các vị trí (được phân trang) sẽ được truy xuất cho tài khoản được yêu cầu. Để biết thêm thông tin về các trường hợp lệ và ví dụ về cách sử dụng, hãy xem Hướng dẫn về cách xử lý dữ liệu vị trí.
|
languageCode (deprecated) |
string
Mã ngôn ngữ BCP 47 để nhận thuộc tính vị trí hiển thị. Nếu ngôn ngữ này không có sẵn, chúng sẽ được cung cấp bằng ngôn ngữ của vị trí. Nếu cả hai tài khoản này đều không có sẵn, chúng sẽ được cung cấp bằng tiếng Anh. Không dùng nữa. Sau ngày 15 tháng 8 năm 2020, trường này sẽ không còn áp dụng nữa. Thay vào đó, ngôn ngữ của vị trí sẽ luôn được sử dụng.
|
orderBy |
string
Thứ tự sắp xếp cho yêu cầu. Nhiều trường phải được phân tách bằng dấu phẩy, theo cú pháp SQL. Thứ tự sắp xếp mặc định là tăng dần. Để chỉ định thứ tự giảm dần, hậu tố " mô tả" cần được thêm vào. Các trường hợp lệ đối với orderBy là locationName và storeCode. Ví dụ: "locationName, storeCode mô tả" hoặc "locationName" hoặc "nội dung mô tả "storeCode"
|
Nội dung yêu cầu
Nội dung yêu cầu phải trống.
Nội dung phản hồi
Nếu thành công, phần nội dung phản hồi sẽ chứa dữ liệu có cấu trúc sau:
Thông báo phản hồi cho Location.ListLocations.
Biểu diễn dưới dạng JSON |
{
"locations": [
{
object (Location )
}
],
"nextPageToken": string,
"totalSize": integer
} |
Trường |
locations[] |
object (Location )
Vị trí.
|
nextPageToken |
string
Nếu số lượng vị trí vượt quá kích thước trang được yêu cầu, trường này sẽ được điền sẵn một mã thông báo để tìm nạp trang vị trí tiếp theo trong lệnh gọi tiếp theo tới locations.list . Nếu không có vị trí nào khác, trường này sẽ không xuất hiện trong câu trả lời.
|
totalSize |
integer
Số lượng Vị trí gần đúng trong danh sách, bất kể việc phân trang.
|
Phạm vi cấp phép
Yêu cầu một trong các phạm vi OAuth sau:
https://www.googleapis.com/auth/plus.business.manage
https://www.googleapis.com/auth/business.manage
Để biết thêm thông tin, hãy xem bài viết Tổng quan về OAuth 2.0.
Trừ phi có lưu ý khác, nội dung của trang này được cấp phép theo Giấy phép ghi nhận tác giả 4.0 của Creative Commons và các mẫu mã lập trình được cấp phép theo Giấy phép Apache 2.0. Để biết thông tin chi tiết, vui lòng tham khảo Chính sách trang web của Google Developers. Java là nhãn hiệu đã đăng ký của Oracle và/hoặc các đơn vị liên kết với Oracle.
Cập nhật lần gần đây nhất: 2025-07-25 UTC.
[null,null,["Cập nhật lần gần đây nhất: 2025-07-25 UTC."],[[["\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)."]]