Google My Business API Minimum Viable Product Demo
This demonstration illustrates how to
perform OAuth 2.0 authorization to access the Google My Business API
fetch categories and attributes for individual regions and languages.
list the available Accounts
list the Locations within an account
create a Location in the specified Account and Location Group
verify the Location and transfer ownership of the new Location to the merchant.
The API Key and OAuth 2.0 Client ID values from your Google Cloud Project - Google APIs & Services menu must be added to the JavaScript source for this page.
Note this code should not be used in production as the OAuth credentials are directly exposed and transmitted to the user's browser.

Please confirm your API credentials and successful OAuth authorization.

OAuth Consent
Trigger one-time OAuth consent, obtain a Refresh token and use it to fetch an Access token used in calls to API methods as described by Using OAuth 2.0 to Access Google APIs
Available attributes vary by category, country and language. The categoryId value can be found in the categoryId field of a Get Categories response.
Account Admins and Locations
These commands operate on an individual account name. The name value can be found in the field of a Get Accounts response.
The Google Location Search method criteria may be specified using a query string or a location object. When searching with a candidate Location object the locationName and optional postalAddress, websiteUrl, primaryPhone fields may be used.
New Locations may be created under the account specified in the name field in the Account Admins and Locations section.

Unknown addresses may require latitude and longitude to be entered. This example uses a ficticious address and failing to specify LatLng will result in an error response. Google will automatically match the Postal Address to known LatLng values if available. Unless prompted, LatLng should be left blank by default.

The business type may be physical storefront, service area, or a hybrid of both types.
For businesses which include a service area a Google Maps regions type is included to define the boundary.
Specifying a service area region or dropping a pin to geocode may be performed using the Google Maps Autocomplete Widget as seen here:

Place ID:
API Request

API Response