Как получать данные об адресах
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
В этом руководстве рассказывается, как получать показатели, связанные с адресами, в профиле компании.
Google My Business API позволяет вам работать с показателями, в том числе получать следующие данные об адресах:
Подготовка
Прежде чем начинать работу с Google My Business API, необходимо зарегистрировать свое приложение и получить учетные данные OAuth 2.0. Подробнее о начале работы с Google My Business API рассказывается в этой статье.
Поддерживаемые данные
Дополнительную информацию о поддерживаемых данных вы можете найти на странице Показатели.
Основные данные
Вы можете получить основные данные для указанного списка адресов. Для этого используйте API accounts.locations.reportInsights
.
Чтобы получить основные данные, связанные с адресом, примените следующий код:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"basicRequest": {
"metricRequests": [
{
"metric": "QUERIES_DIRECT"
},
{
"metric": "QUERIES_INDIRECT"
}
],
"timeRange": {
"startTime": "2016-10-12T01:01:23.045123456Z",
"endTime": "2017-01-10T23:59:59.045123456Z"
}
}
}
Маршруты проезда
Вы можете получить сведения о маршрутах проезда к перечисленным адресам. Для этого используйте API accounts.locations.reportInsights
.
Чтобы получить данные об автомобильных маршрутах, примените следующий код:
POST
https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights
{
"locationNames": [
"accounts/{accountId}/locations/{locationId}"
],
"drivingDirectionsRequest": {
"numDays": "NINETY"
}
}
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-08-29 UTC.
[null,null,["Последнее обновление: 2025-08-29 UTC."],[[["\u003cp\u003eThis tutorial demonstrates how to retrieve location metrics, such as basic insights and driving directions, using the Google My Business API.\u003c/p\u003e\n"],["\u003cp\u003eBefore using the API, you'll need to register your application and obtain OAuth 2.0 credentials as outlined in the basic setup guide.\u003c/p\u003e\n"],["\u003cp\u003eYou can retrieve basic insights like direct and indirect queries for specific locations within a defined timeframe using the \u003ccode\u003eaccounts.locations.reportInsights\u003c/code\u003e API.\u003c/p\u003e\n"],["\u003cp\u003eDriving direction metrics, including data for the past 90 days, can also be retrieved using the \u003ccode\u003eaccounts.locations.reportInsights\u003c/code\u003e API with a driving directions request.\u003c/p\u003e\n"],["\u003cp\u003eRefer to the Metric reference page for a comprehensive list of supported insights available through the Google My Business API.\u003c/p\u003e\n"]]],[],null,["# Retrieve location insights\n\n\u003cbr /\u003e\n\nThis tutorial shows you how to retrieve location metrics in Business Profile.\nThe Google My Business API provides you with the ability to work with location\nmetrics to retrieve the following types of data:\n\n- [Supported insights](#supported_insights)\n- [Basic insights](#basic_insights)\n- [Driving directions](#driving_directions)\n\nBefore you begin\n----------------\n\nBefore you use the Google My Business API, you need to register your application\nand obtain OAuth 2.0 credentials. For details on how to get started with the\nGoogle My Business API, see [Basic setup](/my-business/content/basic-setup).\n\nSupported insights\n------------------\n\nFor supported insights, see the [Metric](/my-business/reference/rest/v4/Metric)\nreference page.\n\nBasic insights\n--------------\n\nRetrieves basic insights for a given list of locations. Use the [`accounts.locations.reportInsights`](/my-business/reference/rest/v4/accounts.locations/reportInsights)\nAPI to return the insights that are associated with a location.\n\nTo return the basic insights associated with a location, use the following:\nHTTP \n\n```\nPOST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights\n{\n \"locationNames\": [\n \"accounts/{accountId}/locations/{locationId}\"\n ],\n \"basicRequest\": {\n \"metricRequests\": [\n {\n \"metric\": \"QUERIES_DIRECT\"\n },\n {\n \"metric\": \"QUERIES_INDIRECT\"\n }\n ],\n \"timeRange\": {\n \"startTime\": \"2016-10-12T01:01:23.045123456Z\",\n \"endTime\": \"2017-01-10T23:59:59.045123456Z\"\n }\n }\n}\n```\n\nDriving directions\n------------------\n\nRetrieves driving direction metrics for a given list of locations. Use the\n[`accounts.locations.reportInsights`](/my-business/reference/rest/v4/accounts.locations/reportInsights)\nAPI to return driving direction metrics that are associated with a location.\n\nTo return the driving direction metrics, use the following:\nHTTP \n\n```\nPOST\nhttps://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights\n{\n \"locationNames\": [\n \"accounts/{accountId}/locations/{locationId}\"\n ],\n \"drivingDirectionsRequest\": {\n \"numDays\": \"NINETY\"\n }\n}\n```"]]