This tutorial shows you how to retrieve location metrics in Business Profile. The Google My Business API provides you with the ability to work with location metrics to retrieve the following types of data:
Before you begin
Before you use the Google My Business API, you need to register your application and obtain OAuth 2.0 credentials. For details on how to get started with the Google My Business API, see Basic setup.
Supported insights
For supported insights, see the Metric reference page.
Basic insights
Retrieves basic insights for a given list of locations. Use the accounts.locations.reportInsights
API to return the insights that are associated with a location.
To return the basic insights associated with a location, use the following:
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" } } }
Driving directions
Retrieves driving direction metrics for a given list of locations. Use the
accounts.locations.reportInsights
API to return driving direction metrics that are associated with a location.
To return the driving direction metrics, use the following:
POST https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations:reportInsights { "locationNames": [ "accounts/{accountId}/locations/{locationId}" ], "drivingDirectionsRequest": { "numDays": "NINETY" } }